Link to home
Start Free TrialLog in
Avatar of Steve Sperber
Steve SperberFlag for United States of America

asked on

Combination of JPA entity and Message Driven Bean

I want to create an entity bean which will pick some data from Topic on JMS Server and also some from database. JMS is publish and subscribe mode. And Persistence is from an RDBMS server.

I want to know if it is feasible or not.
How would its sequence and class diagram look like?
If so what are the limitations of this architecture?
Avatar of Steve Sperber
Steve Sperber
Flag of United States of America image

ASKER

To give more insight on this.

I have trading website and there is Asset Table(or Entity) which stores list of companies and and type of asset such as (share/stock/Mutual Fund/Bonds).

We need to get the price for that asset from a JMS Topic and display to the user. So is there a way that the JPA Entity can also act as JMS Consumer or not.

What is the best way for the asset entity to fetch the Price from JMS Server.
ASKER CERTIFIED SOLUTION
Avatar of Jim Cakalic
Jim Cakalic
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Correct my understanding:-


I had the feeling that Message Driven Bean(MDB - Object) and Entity( EB -persistent object) are managed by application server separately in different pools.

If I mix both MDB and EB class feature into one class then I will not be using the application server's pool of objects feature.

Now to answer your question:-
Yes.  Asset prices are published for all stocks through a topic and I need to know the price for one or two of the shares at a time. Thus there is a need to persist the prices and query for that share.


The JMS Topic server will publish the new prices of all the stocks every few seconds and to store that in my local database and query them and then send to user the latest stock price will result in showing stale data as well as need to maintain huge database for storing transient stock data.

To have the best of both worlds I thought that I will put listeners on Asset entity and filter the message without storing the price all in real time.
I've requested that this question be closed as follows:

Accepted answer: 500 points for jim_cakalic's comment #a37331569
Assisted answer: 0 points for jgdvishnu's comment #a37394900

for the following reason:

I feel that for some  part my understanding is correct.