-
1. Re: JBoss ESB and JMS message re-delivery
h.wolffenbuttel Sep 5, 2011 10:16 AM (in response to joe_boy12)Hi Joe,
Throwing an exception is not the way to enable re-delivery. I suspect you have an A-B-C variant where A is your client and B is your ESB and C an unresponsive endpoint. If C sends a (faulty)message, the JBossESB normally handles it as being delivered. This behaviour is fine for most but not when you want to achieve QOS. For the A-B-C variant you can implement the following setup (if you are using httpRouter):
step 1: create an ESB as you normally would
step 2: move your httprouter to a different service where the scope must be INVM
step 3: create an action which can invoke the httprouter-service and put a try/catch around that invoke.
step 4: there are 2 choises: 1. implement the httprouter and throw an exception (which can be caught by step3 try/catch) when not recieving the right input
2. implement the httprouter and set the messagebody to a value you can check in step 3 when not recieving the right input.
step 5: put a while loop around the try/catch of step 3 and exit when 1. there is no exception
2. the returnvalue is to your liking
If you are persisting your messages, then your message will stay in the step 3 service, for as long as the redelivery fails. You can ofcourse add any delays into the loop to make the redelivery more efficient.
If there are any others who have a similar or even a better sollution, please reply.
regards,
Hans
-
2. Re: JBoss ESB and JMS message re-delivery
joe_boy12 Sep 7, 2011 12:26 AM (in response to h.wolffenbuttel)Thanks Hans for your help - I dont have any transactional DB where I can store the failed message at Step 3 and I dont know how to pull the message from MessageStore without looping thru all undelivered messages. I dont want the for loop b'coz I need to try after 30 min 5 times - more over my application receives over 70K messages per day so I dont know how that will cope up. I liked your idea to have HttpRouter in a separate service and call that from an action (I believe with ServiceInvoker) - I tried that - but it throws following exception.
org.jboss.soa.esb.listeners.message.IncompatibleTransactionScopeException: Request-response attempt within running transaction controlling request delivery!
My message is backed my JMS provider so I can configure redelivery in config file if something goes wrong, however when I try to send that message to this HttpRouter service so that I can get the handle back to check response status or response text - I get above exception.
-
3. Re: JBoss ESB and JMS message re-delivery
h.wolffenbuttel Sep 7, 2011 3:41 AM (in response to joe_boy12)Take a look at the org.jboss.soa.esb.actions.SyncServiceInvoker. It has a way of postponing the transaction so you can make your transactional call without any problems.
What I was trying to explain is that as long as your action has control over the message you can do what you want with it. (this means you dont have to get it from anywhere because it is still in your session) So if you have a method process in a class we now will call ResendAgent and you implement a while loop with a conditional break, you can invoke the MessageSenderService ( just a name for your service with the httprouter) as often as you want which means also only 5 times. Also I mentioned that you can put in a delay like Thread.sleep(300000) to wait for 5 minutes or more if you want to.
For handeling your workload, I don't think there will be any difference in any chosen solution because:
- If the service is not responding, you can't get any other messages to that service.
- the messages which can't be delivered have to be stored somewhere, so space is always needed.
regards,
Hans