I'm trying to debug a web app hostde on weblogic 10r3 server. The App is receiving input from foreign IBM JMS Queue (classname: com.ibm.mq.jms.MQQueue
) via Java Message Driven Beans.
I wrote a small Test App to connect to that queue and sending test messages. The problem is for now test message generates exceptions and somehow it gets put back on queue and is looping again and again. This generate lots of exceptions rendering log unreadable.
First I tried remove the poison message by constructing a consumer on my Test App, but the code blocks indefinitely on consumer.receive()
.
Then I tried to set JMSexpiration
to some number instead of default 0, but in the end the message still used 0 as expiration.
All Ideas Welcome, Many Thanks
Code outline the JMS PRODUCER:
static String rawTradeUpload = "some long chunk of data"
Hashtable ht = new Hashtable();
ht.put(Context.INITIAL_CONTEXT_FACTORY,
weblogic.jndi.WLInitialContextFactory.class.getName());
//ht.put(Context.PROVIDER_URL, "t3://gprimeap1d.eur.nsroot.net:12016");
ht.put(Context.PROVIDER_URL, "t3://gprimeap1d.eur.nsroot.net:12001");
ht.put(Context.SECURITY_PRINCIPAL, "weblogic");
ht.put(Context.SECURITY_CREDENTIALS, "welcome5");
Connection con = null;
Session s = null;
try {
if(ctx == null)
ctx = new InitialContext(ht);
ConnectionFactory myConnFactory = null;
Queue myQueue = null;
myConnFactory = (ConnectionFactory) ctx
.lookup("SwiftConnectionFactory");
con = myConnFactory.createConnection();
s = con.createSession(false, Session.AUTO_ACKNOWLEDGE);
myQueue = (Queue) ctx
.lookup("IncomingSwiftFxQueue");
MessageProducer producer = s.createProducer(myQueue);
Message msg = s.createTextMessage(rawTradeUpload);
producer.send(msg);
s.close();
con.close();
} catch (NamingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (JMSException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}