gu.simplemq.proton.ProtonRuntimeContext Maven / Gradle / Ivy
package gu.simplemq.proton;
import java.util.Properties;
import javax.jms.JMSException;
import javax.jms.Message;
import org.apache.qpid.jms.JmsDestination;
import org.apache.qpid.jms.message.JmsMessage;
import gu.simplemq.BaseMQContext;
import gu.simplemq.IMessageQueueFactory;
import gu.simplemq.MQPropertiesHelper;
import gu.simplemq.MessageQueueType;
import gu.simplemq.jms.MessageQueueFactoryImpl;
import gu.simplemq.jms.JmsRuntimeContext;
class ProtonRuntimeContext extends BaseMQContext implements JmsRuntimeContext {
static final ProtonRuntimeContext PROTON_CONTEXT = new ProtonRuntimeContext();
private final ProtonPropertiesHelper protonHelper;
private final MessageQueueFactoryImpl factory;
public ProtonRuntimeContext() {
super(MessageQueueType.ACTIVEMQ, "AMQP");
protonHelper = new ProtonPropertiesHelper(this);
factory = new MessageQueueFactoryImpl(this);
}
@Override
public MQPropertiesHelper getPropertiesHelper() {
return protonHelper;
}
@Override
public IMessageQueueFactory getMessageQueueFactory(){
return factory;
}
@Override
public PooledConnectionFactory createPooledConnectionFactory(Properties properties) {
PooledConnectionFactory pool = new PooledConnectionFactory();
pool.setProperties(properties);
return pool;
}
@Override
public String destNameOf(Message message) throws JMSException {
JmsMessage jmsMessage = (JmsMessage) message;
JmsDestination dest = (JmsDestination) (jmsMessage.getJMSDestination());
return dest.getName();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy