Created
November 3, 2011 21:41
-
-
Save sachin-handiekar/1337866 to your computer and use it in GitHub Desktop.
A custom Oracle AQ QueueDestinationFactory 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 org.springframework.beans.factory.FactoryBean; | |
import oracle.jms.AQjmsSession; | |
import javax.jms.Queue; | |
import javax.jms.QueueConnection; | |
import javax.jms.QueueConnectionFactory; | |
import javax.jms.Session; | |
public class OracleAQQueueDestinationFactory implements FactoryBean<Queue> { | |
private QueueConnectionFactory connectionFactory; | |
private String queueUser; | |
private String queueName; | |
public Queue getObject() throws Exception { | |
QueueConnection queueConnection = connectionFactory.createQueueConnection(); | |
AQjmsSession session = (AQjmsSession) queueConnection.createQueueSession(true, Session.SESSION_TRANSACTED); | |
return session.getQueue(queueUser, queueName); | |
} | |
public Class<Queue> getObjectType() { | |
return javax.jms.Queue.class; | |
} | |
public boolean isSingleton() { | |
return false; | |
} | |
public void setConnectionFactory(QueueConnectionFactory connectionFactory) { | |
this.connectionFactory = connectionFactory; | |
} | |
public void setQueueUser(String queueUser) { | |
this.queueUser = queueUser; | |
} | |
public void setQueueName(String queueName) { | |
this.queueName = queueName; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment