1 Reply Latest reply on Jul 22, 2011 10:16 AM by Rogelio Sevilla

    Service or new instance?

    Rogelio Sevilla Novice

      Hello everyone:


      I'm still learning about fuse esb and camel and sometimes i come up with questions that i think are too basic but still, don't know the answer :-S  .


      I've already deployed some bundles and camel routes into my fuse esb, and i got to a point where i must decide if i should provide some functionalitiy as a service or not.


      For example, i have a bundle that inserts data into my database, and what i'm doing for now is just instantiating that class every time i need it from other bundles and calling it's methods.


      When i deployed this same class as a service, i started having problems because my jdbc connection was closed, i guess i should apply some synchronyzed blocks here and there because now all the bundles are using the exact same pojo, or at least that's what i think it's happening.



      But to be honest, my main questions are:


      1.- what's the advantage between using another bundle as a service or just     instantiating one of the classes inside on another bundle??


      2.- Do i lose fuse esb clustering (or other) advantages using either approach??



      Thanks a lot in advance :-D