aspose file tools*
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes External JMS System access Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "External JMS System access" Watch "External JMS System access" New topic
Author

External JMS System access

Ionut Bucurescu
Ranch Hand

Joined: Dec 19, 2006
Posts: 68
Hello ranchers,

I'm a client of an external system that is likely to have a JMS interface.
What is the best approach to access it?
1. Facade
2. Bridge
3. Adapter
4. Service Activator

Thanks.


SCJP 1.4, SCBCD 5.0, SCDJWS 5.0, SCEA5
Ionut Bucurescu
Ranch Hand

Joined: Dec 19, 2006
Posts: 68
Come on, nobody is willing to answer?
I would use the Facade pattern to decouple the client from the JMS details and to expose a single central interface.
Dmitri Ericsson
Ranch Hand

Joined: Feb 16, 2010
Posts: 109
Hi,
I think that the Proxy is more suitable here, because in my opinion both Service Activator and Facade are patterns which are implemented in order to expose some interface to the client. In your case you do not have any control over the external system, it already has some kind of interface. All you need is to build a class on the client side to simplify the message exchange. So I think old-good proxy suits here most
Br,
Dmitri


SCEA 5, SCJP 6 My SCEA Experience
Ionut Bucurescu
Ranch Hand

Joined: Dec 19, 2006
Posts: 68
Thanks Dmitri. That sounds like a good alternative even if my external system does not have a real interface but a JMS queue to which it listens.
Teja Saab
Rancher

Joined: Mar 08, 2010
Posts: 152
Ionut Bucurescu wrote:Hello ranchers,

I'm a client of an external system that is likely to have a JMS interface.
What is the best approach to access it?
1. Facade
2. Bridge
3. Adapter
4. Service Activator

Thanks.


I think that the Service Activator would be the correct answer here. Since the external system has a JMS interface, it is obvious that the incoming messages to the external system would be processed asynchronously. Maybe the messages are processed after a few hours or a few days. We don't know and we cannot make an assumption that the messages will be processed immediately.

Also if messages were to be processed immediately, a JMS interface would not have been provided.

I think that a proxy pattern would be more appropriate in a synchronous situation where you just don't want the client application to interact directly with the real service. I don't think that the proxy pattern is a good pattern to use in an asynchronous scenario. So I would say that Service Activator is the right answer.

Just my thoughts though.....


SCEA 5, SCJD,SCWCD,SCJP,PMP,IBM-SOA Solution designer,IBM-XML
Dmitri Ericsson
Ranch Hand

Joined: Feb 16, 2010
Posts: 109
I've looked at the service activator model http://java.sun.com/blueprints/corej2eepatterns/Patterns/ServiceActivator.html and it says that it is to be implemented on the server side, basically service activator is the class that receives a message, invokes business logic and sends a response back. In the topicstarter's case the external system is solid and cannot be changed.

By the way in the article above there is an example and it seems that Facade is the right answer (OrderDispatcherFacade in the example) Yes, I've criticized the facade choice, but when the external system sends a reply to the your message and you have to receive it, then a Facade is the correct thing.
Teja Saab
Rancher

Joined: Mar 08, 2010
Posts: 152
Dmitri Ericsson wrote:I've looked at the service activator model http://java.sun.com/blueprints/corej2eepatterns/Patterns/ServiceActivator.html and it says that it is to be implemented on the server side, basically service activator is the class that receives a message, invokes business logic and sends a response back. In the topicstarter's case the external system is solid and cannot be changed.

By the way in the article above there is an example and it seems that Facade is the right answer (OrderDispatcherFacade in the example) Yes, I've criticized the facade choice, but when the external system sends a reply to the your message and you have to receive it, then a Facade is the correct thing.




Hi Dmitri,

I can see your point. However there is no indication in the question that suggests that the client is a browser based thin or thick client. We cannot rule out the fact that the client could be on the server side. All that the question says is that a client needs to access an external system. EJBs can be clients too to external systems. In this case, since the client (possibly an EJB) wants to access an external system which uses a JMS interface, I think that a service activator is still right.

Just my 0.02 though.

Thanks,
Ionut Bucurescu
Ranch Hand

Joined: Dec 19, 2006
Posts: 68
Hi Teja,

Indeed we are in the ejb container having the ejb as client for the external system. The ServiceActivator is for receiving a message but in my case the external system is receiving the message. The client only needs to send a message to the external system's JMS queue. The sending doesn't need to be asynchronous.

I'm thinking that even the Business Delegate is more appropriate for this scenario than the Facade because I'm not dealing with a complex subsystem.

Thanks for sharing your thoughts.
Dmitri Ericsson
Ranch Hand

Joined: Feb 16, 2010
Posts: 109
Hi,
Business Delegate sounds a good solution, but according to the manual http://java.sun.com/blueprints/corej2eepatterns/Patterns/BusinessDelegate.html the problem where this pattern is used is when
Presentation-tier components interact directly with business services. This direct interaction exposes the underlying implementation details of the business service application program interface (API) to the presentation tier

So it is a presentation tier pattern and as I understand you send your JMS message from business logic component
Ionut Bucurescu
Ranch Hand

Joined: Dec 19, 2006
Posts: 68
In the same pattern it is written that
... this pattern could be used to reduce coupling between other tiers, not simply the presentation and the business tiers. ...
The Business Delegate also handles the exceptions from the business services, such as java.rmi.Remote exceptions, Java Messages Service (JMS) exceptions and so on. ....
The BusinessService is a business-tier component, such as an enterprise bean or a JMS component, that provides the required service to the client.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: External JMS System access