activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bravegag <brave...@hotmail.com>
Subject hacking 5.2.0 TopicSubsciption but can't get hold of the Session
Date Thu, 22 Oct 2009 17:00:22 GMT

hi all,

I was previously asking how to extend the constant message pending limit
strategy to  send a custom "discarded" message to the replyTo field of the
old message before discarding it so a blocked sender can be released. This
architecture in general does not make much sense on top of JMS ... blocking
etc but this is a school benchmarking assignment ...

The code below is copied from 5.2 TopicSubscription.java line #116 I am
hacking to support such notify "discarded feature".

The only problem I have is that I don't know where to get the session from
to generate such reply "discarded" message ... any ideas? have been browsing
all the members etc but no clue where to get it from ...

Thanks in advance,
Best regards,
Giovanni
 // hack hack hack hack
 // hack hack hack hack
 // hack hack hack hack	                                
 if (oldMessage instanceof TextMessage) {
    TextMessage textMessage = (TextMessage) oldMessage;
    Destination destination = (Destination) textMessage.getJMSReplyTo();
    if (destination != null) {
       // Setup a message producer to respond to messages from clients, we
will get the destination
       // to send to from the JMSReplyTo header field from a Message
       MessageProducer replyProducer = session.createProducer(null);
		                                         
       replyProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);	                      
         	
		                                	
       TextMessage response = session.createTextMessage();  
       response.setText("DISCARDED");
		                                    
       replyProducer.send(response);	                                    
       replyProducer.close();	                                		
}	                                	
}
	                                
// after notifying then discard
discard(oldMessage);

-- 
View this message in context: http://www.nabble.com/hacking-5.2.0-TopicSubsciption-but-can%27t-get-hold-of-the-Session-tp26013589p26013589.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message