Search in sources :

Example 36 with JmsConnection

use of com.adaptris.core.jms.JmsConnection in project interlok by adaptris.

the class BlobMessageTranslatorTest method testMoveMetadataJmsMessageToAdaptrisMessage.

@Test
public void testMoveMetadataJmsMessageToAdaptrisMessage() throws Exception {
    MessageTypeTranslatorImp trans = new BlobMessageTranslator();
    JmsConnection conn = null;
    try {
        conn = activeMqBroker.getJmsConnection(new BasicActiveMqImplementation());
        start(conn);
        Session session = conn.createSession(false, Session.CLIENT_ACKNOWLEDGE);
        Message jmsMsg = createMessage(session);
        addProperties(jmsMsg);
        trans.registerSession(session);
        trans.registerMessageFactory(new DefaultMessageFactory());
        start(trans);
        AdaptrisMessage msg = trans.translate(jmsMsg);
        assertMetadata(msg);
    } finally {
        stop(trans);
        stop(conn);
    }
}
Also used : DefaultMessageFactory(com.adaptris.core.DefaultMessageFactory) AdaptrisMessage(com.adaptris.core.AdaptrisMessage) Message(javax.jms.Message) AdaptrisMessage(com.adaptris.core.AdaptrisMessage) MessageTypeTranslatorImp(com.adaptris.core.jms.MessageTypeTranslatorImp) JmsConnection(com.adaptris.core.jms.JmsConnection) Session(javax.jms.Session) ActiveMQSession(org.apache.activemq.ActiveMQSession) Test(org.junit.Test)

Example 37 with JmsConnection

use of com.adaptris.core.jms.JmsConnection in project interlok by adaptris.

the class EmbeddedActiveMq method getJndiPtpConnection.

public JmsConnection getJndiPtpConnection(StandardJndiImplementation jv, boolean useJndiOnly, String queueName, String topicName) {
    JmsConnection result = new JmsConnection();
    StandardJndiImplementation jndi = applyCfg(jv, useJndiOnly, queueName, topicName);
    jndi.setJndiName("queueConnectionFactory");
    result.setVendorImplementation(jndi);
    result.setClientId(createSafeUniqueId(jndi));
    result.setConnectionRetryInterval(new TimeInterval(3L, TimeUnit.SECONDS));
    result.setConnectionAttempts(1);
    return result;
}
Also used : TimeInterval(com.adaptris.util.TimeInterval) StandardJndiImplementation(com.adaptris.core.jms.jndi.StandardJndiImplementation) FailoverJmsConnection(com.adaptris.core.jms.FailoverJmsConnection) JmsConnection(com.adaptris.core.jms.JmsConnection)

Example 38 with JmsConnection

use of com.adaptris.core.jms.JmsConnection in project interlok by adaptris.

the class EmbeddedActiveMq method getJndiPasConnection.

public JmsConnection getJndiPasConnection(StandardJndiImplementation jv, boolean useJndiOnly, String queueName, String topicName) {
    JmsConnection result = new JmsConnection();
    StandardJndiImplementation jndi = applyCfg(jv, useJndiOnly, queueName, topicName);
    jndi.setJndiName("topicConnectionFactory");
    result.setVendorImplementation(jndi);
    result.setClientId(createSafeUniqueId(jndi));
    result.setConnectionRetryInterval(new TimeInterval(3L, TimeUnit.SECONDS));
    result.setConnectionAttempts(1);
    return result;
}
Also used : TimeInterval(com.adaptris.util.TimeInterval) StandardJndiImplementation(com.adaptris.core.jms.jndi.StandardJndiImplementation) FailoverJmsConnection(com.adaptris.core.jms.FailoverJmsConnection) JmsConnection(com.adaptris.core.jms.JmsConnection)

Example 39 with JmsConnection

use of com.adaptris.core.jms.JmsConnection in project interlok by adaptris.

the class EmbeddedArtemis method getJmsConnection.

public JmsConnection getJmsConnection() {
    StandardJndiImplementation standardJndiImplementation = new StandardJndiImplementation("ConnectionFactory");
    standardJndiImplementation.getJndiParams().addKeyValuePair(new KeyValuePair("java.naming.factory.initial", "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"));
    standardJndiImplementation.getJndiParams().addKeyValuePair(new KeyValuePair("java.naming.provider.url", "vm:/1"));
    return applyCfg(new JmsConnection(), standardJndiImplementation, false);
}
Also used : KeyValuePair(com.adaptris.util.KeyValuePair) StandardJndiImplementation(com.adaptris.core.jms.jndi.StandardJndiImplementation) JmsConnection(com.adaptris.core.jms.JmsConnection)

Example 40 with JmsConnection

use of com.adaptris.core.jms.JmsConnection in project interlok by adaptris.

the class BasicActiveMqConsumerTest method retrieveObjectForSampleConfig.

@Override
protected Object retrieveObjectForSampleConfig() {
    JmsConnection connection = new JmsConnection();
    PtpConsumer producer = new PtpConsumer();
    producer.setQueue("destination");
    UrlVendorImplementation vendorImpl = createImpl();
    vendorImpl.setBrokerUrl(BasicActiveMqImplementationTest.PRIMARY);
    connection.setUserName("BrokerUsername");
    connection.setPassword("BrokerPassword");
    connection.setVendorImplementation(vendorImpl);
    StandaloneConsumer result = new StandaloneConsumer();
    result.setConnection(connection);
    result.setConsumer(producer);
    return result;
}
Also used : PtpConsumer(com.adaptris.core.jms.PtpConsumer) UrlVendorImplementation(com.adaptris.core.jms.UrlVendorImplementation) JmsConnection(com.adaptris.core.jms.JmsConnection) StandaloneConsumer(com.adaptris.core.StandaloneConsumer)

Aggregations

JmsConnection (com.adaptris.core.jms.JmsConnection)47 Test (org.junit.Test)25 StandaloneProducer (com.adaptris.core.StandaloneProducer)17 StandardJndiImplementation (com.adaptris.core.jms.jndi.StandardJndiImplementation)14 TimeInterval (com.adaptris.util.TimeInterval)14 PasProducer (com.adaptris.core.jms.PasProducer)12 MockChannel (com.adaptris.core.stubs.MockChannel)10 StandaloneConsumer (com.adaptris.core.StandaloneConsumer)8 PtpProducer (com.adaptris.core.jms.PtpProducer)8 KeyValuePair (com.adaptris.util.KeyValuePair)6 Adapter (com.adaptris.core.Adapter)5 PtpConsumer (com.adaptris.core.jms.PtpConsumer)5 MockMessageProducer (com.adaptris.core.stubs.MockMessageProducer)5 AdaptrisMessage (com.adaptris.core.AdaptrisMessage)4 DefaultMessageFactory (com.adaptris.core.DefaultMessageFactory)4 SharedConnection (com.adaptris.core.SharedConnection)4 MessageTypeTranslatorImp (com.adaptris.core.jms.MessageTypeTranslatorImp)4 UrlVendorImplementation (com.adaptris.core.jms.UrlVendorImplementation)4 MockMessageListener (com.adaptris.core.stubs.MockMessageListener)4 Message (javax.jms.Message)4