Created
November 3, 2011 21:43
-
-
Save sachin-handiekar/1337875 to your computer and use it in GitHub Desktop.
A custom Oracle AQ MessageListener (XML Type payload) for Spring JMS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.sachinhandiekar.oracle.aq; | |
import javax.jms.Message; | |
import javax.jms.MessageListener; | |
import org.springframework.transaction.annotation.Transactional; | |
import oracle.jms.AQjmsAdtMessage; | |
import oracle.xdb.XMLType; | |
public class OracleMessageListener implements MessageListener { | |
@Transactional | |
public void onMessage(Message message) { | |
try { | |
//Converting message into XmlType payload | |
XMLType xmlMsg = (XMLType) ((AQjmsAdtMessage) message).getAdtPayload(); | |
System.out.println("XML Payload ==> " + xmlMsg.getStringVal()); | |
} | |
catch (Exception e) { | |
// Catch any exception here | |
e.printStackTrace(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment