Do we have a design flaw?

Hello everyone... just wanted to get some quick peer review action going here...

Okay I won't waste your time with a lot of "big picture" **** of this entire mamoth application we are building... but to try to make a long story short here's the basic idea:

We are doing a lot of main frame integration with a J2EE application (using Websphere and MQSeries). We have a series of EJB's that contain (duh) a lot of our business logic.

We are also using SeeBeyond tools to model business processes... essentially the example where I believe we may have a minor design flaw is this:

SeeBeyond (e*Insight/e*Gate/e*Way) instantiates an EJB. The EJB is responsible for querying one of the databases to build a message that will be written to an MQSeries Queue (which the MF will then read). The EJB simply passes back to e*Insight a ValueObject with the parameters required to construct the message... e*Insight constructs the message then sends this message to the Queue.

Originally I constructed this bean to send the message to the Queue... but was advised against doing that because we would be coupling a specific behavior to that EJB... which I can see... but I also thought that was kinda the point of an EJB... it does a specific task within its problem space.

"Decoupling" messaging from the EJB and moving that responsibility to the client (which may be e*Insight, or in other instances, ColdFusion) does this represent a design flaw, inparticular a "violation" in the J2EE spec?

e*Insight (via e*Ways) are perfectly capable of doing messaging... in fact its the "core" of this product... and to also clarify a bit... this business process I am describing is a credit check. The EJB receives and Order ID from a client. The EJB queries the database, constructs a Value Object and passes that back to the client. The client then writes to the Queue... the MF reads the queue... does the credit check and writes a response to a reply queue. All of this is asynchronous.

So, if the EJB writes to the queue... it contains only one public method: sendRequest(ord_id). Because we never know when the MF may do its thing... the client has the facility to be "triggered" by the reply queue... so the EJB should never worry about getting replies.

I guess the question is this simple: should the EJB be responsible for messaging or is it fine to let the client worry about sending the message?

I know... not exactly earth shattering... but just want to make sure that as this system grows (bloats) we aren't making potential mountains out of mole hills.

./dave

[2635 byte] By [Minusone] at [2007-9-27 17:35:27]
# 1

Why don't you have two EJB's, one that represents the Order and the other EJB that provides the business logic of writing the message? This would keep things decoupled and each piece would have very well defined responsibilities, which would allow the pieces to be reused easily. So you client may call a Stateless Session EJB with the order ID, the stateless session bean would call the Entity EJB for the order, get the value object from the entity bean and then construct a message and put it on the queue.

Just a suggestion. I would have to know a lot more about the details of what you are building and how this system may evolve in the future before I could make more than "passing" suggestions.

--Maciej

www.urbancode.com

maciejz at 2007-7-6 12:50:08 > top of Java-index,Other Topics,Patterns & OO Design...
# 2

I apologize for forking this thread, but we are having some difficulties integrating our J2EE app with SeeBeyond. Apparently we cannot send or receive a JMS message with message type ObjectMessage. Apparently SeeBeyond supports only text message formats? I find this difficult to believe but do not have the SeeBeyond expertise to refute our experts opinions. Could you explain how you are instantiating an EJB within SeeBeyond? Our approach appears to be radically different.

mleaning at 2007-7-6 12:50:08 > top of Java-index,Other Topics,Patterns & OO Design...