Win a copy of Modern JavaScript for the Impatient this week in the Server-Side JavaScript and NodeJS forum!

Dominic Marinaro Soundranayagam

Greenhorn
+ Follow
since May 19, 2010
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Dominic Marinaro Soundranayagam

Hi Team
I Have a main thread which will poll the messages from the Queue
and create a child thread to process it .The requirement is Both the parent and the child should be in one transaction unit.
Here is my application config.


Code for M1GenericConnector

Code For ConnectorTask


public class QueueUtility {

private JmsTemplate jmsTemplate;

public JmsTemplate getJmsTemplate() {
return jmsTemplate;
}

public void setJmsTemplate(JmsTemplate jmsTemplate) {
this.jmsTemplate = jmsTemplate;
this.jmsTemplate.setReceiveTimeout(1500);
}

public Message retrive(final String destinationName){
return jmsTemplate.receive(destinationName);
}

public void sendMessage(final String destinationName ,final String message){
jmsTemplate.convertAndSend(destinationName, message);
}

public void sendMessage(final String destinationName ,final Map<String,Object> message){
jmsTemplate.send(destinationName, new MessageCreator() {

@Override
public Message createMessage(Session arg0) throws JMSException {
// TODO Auto-generated method stub
MapMessage mapmessage = arg0.createMapMessage();
for (Map.Entry<String, Object> entry : message.entrySet()) {
mapmessage.setObjectProperty(entry.getKey(), entry.getValue());
}
return mapmessage;
}
});
}

}
[/CODE]

Code for M1OperatorLoader


But the Poblem is in the Queue there were 5 messages each messages DEST_ID value is 0 ,1,2,3 respectively.So according to the program two messages should be rollback and remain should poll off from queue(commited)
But when i run this program no message get off from the in bound queue....
Please help me out what is the actual problem in my code
10 years ago
Hi Guys
I am stuck in the following scenario.Please advice me on this

There is an inbound Queue
There is an Main thread running(We are not using JMS Listener )
and picking a message from the queue and process the message
and start another sub thread to process again.

Now the problem is How can i handle the transaction in the main thread and sub thread as well.
which mean when i process the message in main thread say some Data Base access error occurs
so i want to rollback the message back to inbound Queue.
and if the same failure occurs in sub thread which was created by the main thread, the retrieved message should rollback to inbound Queue.

I have walked through the JMS Spring Reference ,But they are demarcate the transaction only to JMS Listeners
So How can i apply the transaction concept in my scenario
Please advice me ,If you have any sample program please share with me .That would be better to understand your concepts

Thanks and Regards
Dominic
Junior Developer
10 years ago
Hi Team

I am involving in SMS Gate way project.
The Very Base function is our system have couple of Customers
They will send their request to our gateway in a form of XML.

Those request is Process first and send it to a common out bound JMS(ActiveMQ 5.3 )

There is an listener running on which should be capable of doing the following
1. Retrive Bunch of Messages(Let say 5 ) on retrieval.
2. The retival should be on demand .It means ,once the listeners triggers only those bunch of message should return .

Guys i really need your help.If you have any idea please help me ou