• Post Reply Bookmark Topic Watch Topic
  • New Topic

EJB Gateway

 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I use a vendor framework that has a single "gateway" EJB. All requests come into a single execute() method that gets a service id from the parameters, looks up a POJO service instance and calls the service execute(). The service has code (generated from a Rose model) that gets the method name from the parameter and invokes the method. There is a (generated) Business Delegate that sets up the parameters so this is transparent to the client.

* Is this kind of gateway common? It seems like a neat way to free the POJO services from EJB dependencies. We never code or deploy a new EJB.

* Are there frameworks that do the same kind of thing?
 
Mike Keith
author
Ranch Hand
Posts: 304
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have certainly seen this pattern on a number of occasions. I don't know how many frameworks have adopted it but it can work for certain kinds of applications, particularly those that are closed. The client API is not very elegant, but if you have a client-side layer that can do all the marshalling then it is a little less unsightly, I guess.

Note that one of the benefits of EJB 3.0 is that the components can be developed as POJOs, so you could use session beans for your POJO services and get the benefits of resource injection, interceptors and so on.

-Mike
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
EJB 3 seems to have a lot of great stuff like that. I don't know if we'll ever get there in our shop, but I need to study up on it for sure.

I worked with another single SSB gateway that was all XML in and out. It was very easy to specify new request/response pairs against existing POJO services without a code release, and also simple to add new POJOs in releases.

BTW: The vendor framework I'm using is pretty sophisticated. The Business Delegate is code-generated and is very easy for clients to use. It supports EJB, raw sockets, XML/HTTP and another weird protocol out of the box. The server has a gateway for each protocol. We made our own gateways for JMS and WebServices. The vendor sometimes over-engineers to a frightening degree, but this bit is neat.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!