• Post Reply Bookmark Topic Watch Topic
  • New Topic

Spawn EJB container for each message read from message queue  RSS feed

 
satish kumar mandoddi
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using the below code to read the messages from the topic and perform my buisiness logic.. however i would like to have a bean created for each message.. rather than one bean processing all the messages..

I am quite new to this usage and on browsing i found that i need to use ejbCreate to create a new bean.. .for processing ..

In my case i am using annotation to initialize the connections to the JMS provider(solace in my case) and bean perfectly reads all the messages but by creating a single bean.. however if i have more than 500 messages a single bean will crash processing them.. any help/pointers to help me initialize a new bean for new message that is read from the queue will he helpful.

 
Paul Clapham
Sheriff
Posts: 22374
42
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
satish kumar mandoddi wrote:however if i have more than 500 messages a single bean will crash processing them.


Really? Why is that? Could you post the stack trace from those crashes? I'm surprised that the error occurs after exactly 500 messages as there isn't anything obvious in the code to cause that.

any help/pointers to help me initialize a new bean for new message that is read from the queue will he helpful.


That doesn't sound like a good idea to me; seems to me that you're going to be doing a lot more work and opening yourself up to other unforeseen problems. I think you should just work on fixing your 500 problem.
 
Paul Clapham
Sheriff
Posts: 22374
42
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And, welcome to the Ranch!
 
satish kumar mandoddi
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:And, welcome to the Ranch!


The number 500 isnt specific.. :).. i meant to say that when i try to increase my number of messages on the queue.. i am not able to see the ejbConstruct being called for every message its reading.. so i am assuming that the request is being processed by a single bean in this case..

 
satish kumar mandoddi
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:And, welcome to the Ranch!


Thank you Paul !
 
satish kumar mandoddi
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
satish kumar mandoddi wrote:
Paul Clapham wrote:And, welcome to the Ranch!


The number 500 isnt specific.. :).. i meant to say that when i try to increase my number of messages on the queue.. i am not able to see the ejbConstruct being called for every message its reading.. so i am assuming that the request is being processed by a single bean in this case..



Below is my ejb-jar.xml configuration.. which helps me with the annotations.. i specify in the file..

 
Paul Clapham
Sheriff
Posts: 22374
42
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
satish kumar mandoddi wrote:i am not able to see the ejbConstruct being called for every message its reading.. so i am assuming that the request is being processed by a single bean in this case..


Yes, it would be perfectly reasonable for a single bean to process all of the requests in the queue. I don't know why you would want to do anything different than that. In fact I haven't seen a description of any problem yet. Have you found that some of the messages are not being processed?
 
satish kumar mandoddi
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:
satish kumar mandoddi wrote:i am not able to see the ejbConstruct being called for every message its reading.. so i am assuming that the request is being processed by a single bean in this case..


Yes, it would be perfectly reasonable for a single bean to process all of the requests in the queue. I don't know why you would want to do anything different than that. In fact I haven't seen a description of any problem yet. Have you found that some of the messages are not being processed?


The messages actually carry the URL information.. and in my logic i am trying to download the files from each URL which i read from the messages.. Downloading usually takes time as it sometimes caters to MB's.. so if i increase my number of messages(now of URL's from which i need to download) the download works only for the first message and for the rest it does not...
 
Paul Clapham
Sheriff
Posts: 22374
42
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
satish kumar mandoddi wrote:Downloading usually takes time as it sometimes caters to MB's.. so if i increase my number of messages(now of URL's from which i need to download) the download works only for the first message and for the rest it does not...


Okay, so now we have a statement of a problem. Unfortunately before investigating the problem you have made a guess at the cause of the problem, and now you're proceeding as if that guess were true. Let's not be in such a hurry. First let's find out what your problem is. Right now we just have "does not work" as a problem description and that isn't very helpful. Have a look at our FAQ entry ItDoesntWorkIsUseless (<== follow that link) and based on what you read there, come back with a better problem description.
 
satish kumar mandoddi
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:
satish kumar mandoddi wrote:Downloading usually takes time as it sometimes caters to MB's.. so if i increase my number of messages(now of URL's from which i need to download) the download works only for the first message and for the rest it does not...


Okay, so now we have a statement of a problem. Unfortunately before investigating the problem you have made a guess at the cause of the problem, and now you're proceeding as if that guess were true. Let's not be in such a hurry. First let's find out what your problem is. Right now we just have "does not work" as a problem description and that isn't very helpful. Have a look at our FAQ entry ItDoesntWorkIsUseless (<== follow that link) and based on what you read there, come back with a better problem description.



My bad.. sorry for not being clear with my question.. let me describe my problem as per the link...

 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!