wood burning stoves 2.0*
The moose likes EJB and other Java EE Technologies and the fly likes JMS Dependencies Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "JMS Dependencies Question" Watch "JMS Dependencies Question" New topic

JMS Dependencies Question

Katie Wright

Joined: May 20, 2003
Posts: 8
I have the following design issue which I believe that JMS will help me resolve but I am not exactly sure how. I don't think that this is a new problem and was hoping that you could help me out.
I have a product called Dog House. I have another product called Dog. Dog depends on Dog House but Dog House cannot depend on Dog. Dog House can be sold separately without Dog but Dog is sold with Dog House. Dog House keeps track of Bones. Every dog in an instance of Dog has a bone (this is where Dog depends on Dog House).
If a bone is deleted from Dog House, I want all associated Dogs to first associated themselves to the default Bone before the deleted bone is removed from the database.
The default Bone cannot be removed.
So I need to do this without creating a circular dependency of Dog House depending on Dog. This means that I cannot make the Bone EJB go check the Dog database table and move any associated Dogs to the default bone.
I know that I can use JMS to make Dog and Dog House message without creating the dependencies but then my understanding is that I don't have any control of the timing of when the messages are received. This means that I could not ensure that Dog got moved to the default bone before I deleted the original bone which would cause a foreign key constraint problem.
Thanks for reading my "dog" of a problem.
Any help will be appreciated,
Katie Wright zero_celsius@hotmail.com
Dana Hanna
Ranch Hand

Joined: Feb 28, 2003
Posts: 227
You have confused me completely. A couple points follow:
The whole Dog - Dog House - Bone relationship makes no physical sense to me. Explain further.
JMS has nothing to do with solving the problem. JMS is merely a way to receive requests.
Kishore Dandu
Ranch Hand

Joined: Jul 10, 2001
Posts: 1934
JMS has message queue mechanism that can solve this dog getting notified about dog house changes. You have to implement it such that your dog processes all the dog house messages related to bones.
The other poster's statement that JMS is only for requests is bogus. JMS is used for messaging and the problem posted by the original poster qualifies for use of JMS.
As long as both Dog and Dog house classes are residing on the same system(when there is no web tier involved) the messaging can be achieved using JMS packages. If not its better to use a app server to accomplish reliable messaging.

SCJP, blog
Dana Hanna
Ranch Hand

Joined: Feb 28, 2003
Posts: 227
Sorry - JMS is merely and way to send AND recieve requests. However, I think that you are over complicating the problem. Sure - JMS would work, but is it a solution - no? JMS just garauntees asynchronous message delivery. If this is one application all within the same JVM, I don't see why you wouldnt use the Listener or Observable patterns.
Why J2EE?
Katie Wright

Joined: May 20, 2003
Posts: 8
Thanks for your assistance. Sorry about the whole confusing Dog House description when trying to describe my problem generically. Anyway, we are using a web tier and a web app so we are also starting to think that JMS is not the way to go. Will investigate the specified patterns further.
I agree. Here's the link: http://aspose.com/file-tools
subject: JMS Dependencies Question
Similar Threads
A simple one (?)
Compiler vs. Runtime Errors
What is the use of super word here?
creating an instance variable of a database table type for persistance
Can you explain what these parts of code mean?