tags:

views:

392

answers:

1

I'm writing a webservice to an external system.

My service wrapper class has a number of methods which call all the soap interface of the webservice. The call can throw an exception which should then automatically trigger a reconnect to the webservice.

To handle that scenario I'd like to use AOP such that all methods which call the SOAP interface should be "wrapped" by an try/catch block. In the catch block the reconnect is done.

I'm not using Spring at the moment, so I'm thinking about introducing JBoss AOP. I need some advice if AspectJ or Spring AOP would be a better alternative.

Thanks.

A: 

Your requirements are pretty basic, so either AspectJ, JBoss AOP or Spring AOP would work for you. That would suggest that going with the simplest option would work best.

  • I believe that AspectJ works using byte-code manipulation, either at compile-time or load-time, which (depending on your setup) is either simple, or a nightmare. It's highly flexible in what you can do, but can be a bit intimidating.
  • Spring AOP is limited (which isn't a problem here, since so are your requirements), but is a purely run-time solution. Its lack of flexibility may be a bonus here, since it's easy to understand
  • JBoss AOP I'm not very familiar with, but it's closer to Spring AOP than it is to AspectJ
skaffman