Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

The most suitable EJB for the senario  RSS feed

 
Steven Lau
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Part of an application's business logic is implemented using a limited set of connections to a legacy system. The development team want to provide an EJB interface to this legacy code. The BEST approach to managing connection resources would be to use BMP Entity Bean?
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No absolutely not. A BMP is the WRONG approach for this. The problem is that BMP's (and CMP's) make several assumptions about the underlying datastore -- primary among which is the assumption that there is a single "primary key" for each BMP instance. (Thus findByPrimaryKey() and the entire caching mechanism that hinges on that).
Well, most legacy systems don't act like relational databases. Instead, if you are using something like a CICS system, it acts much more like a collection of function calls (each transaction is a function). We have found that a Session bean is a much more natural representation for a legacy system in this case.
Kyle
 
Gregory Garrison
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roland or Kyle, I have a seperate post for this question but since you are on this topic I thought I would ask here as well. Could you please explain your approach in connecting ejb's to a legacy system. We have several tcp/ip connected systems and are replacing the middleware routing with an application server. What is the best approach in connecting to existing tcp/ip oriented applications.
Thanks.
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Personally, I prefer the Session bean approach where a Session Facade (ala "Core J2EE Patterns") wraps a special layer of helper objects that manage your legacy system communication.
Now, that's fairly easy to do. So long as your communication is synchronous it presents no problems (that is you send a request down a socket, turn around and wait for the response, and time out if you don't receive one).
However, asynchrounous communication is more problematic. There you have to do some nasty tricks like for instance implementing "bridges" between an asynchronous listener on your socket and a JMS queue (listen on the socket, when you get a request, pop it on a queue and then have an MDB waiting on that queue). Another trick is to simply put the asynchronous listener in the Servlet engine (web container) rather than in the EJB container.
However, your best bet is to see if it's at all possible to lose the existing TCP/IP infrastructure and see if you can't move to something like JCA. There are now JCA connectors for a number of different types of system -- the days of people writing their own middleware layers are numbered. One thing I would NOT recommend, btw, is trying to write your own JCA layer on top of an existing structure -- writing JCA connectors is a tricky business best left to vendors if at all possible.
Kyle
[ March 26, 2002: Message edited by: Kyle Brown ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!