Examples of JMSConfiguration


Examples of org.apache.cactus.util.JmsConfiguration

     * {@inheritDoc}
     * @see AbstractCactusTestCase#createProtocolHandler()
     */
    protected ProtocolHandler createProtocolHandler()
    {
        return new JmsProtocolHandler(new JmsConfiguration());
    }
View Full Code Here

Examples of org.apache.camel.component.jms.JmsConfiguration

    /*
     * Adds a local in memory JMS component for the test
     */
    private void addTestJmsComponent() {
        ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("vm://test?broker.persistent=false");
        JmsConfiguration jmsConfig = new JmsConfiguration(connectionFactory);
        JmsComponent component = new JmsComponent(jmsConfig);
        context.addComponent("jms", component);
    }
View Full Code Here

Examples of org.apache.camel.component.jms.JmsConfiguration

        context.stop();
    }

    private void addJmsComponent(CamelContext context) {
        ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("tcp://localhost:61616");
        JmsConfiguration jmsConfig = new JmsConfiguration(cf);
        context.addComponent("jms", new JmsComponent(jmsConfig));
    }
View Full Code Here

Examples of org.apache.camel.component.jms.JmsConfiguration

public class Jms2RestStarter {

   
    public void run() throws Exception {
        CamelContext context = new DefaultCamelContext();
        JmsConfiguration jmsConfig = new JmsConfiguration(new ActiveMQConnectionFactory("tcp://localhost:61616"));
        context.addComponent("jms", new JmsComponent(jmsConfig ));
        context.setTracing(true);
        context.addRoutes(new Jms2RestRoute());
        context.start();
        System.in.read();
View Full Code Here

Examples of org.apache.camel.component.jms.JmsConfiguration

* @version $Revision: 652240 $
*/
public class JmsProviderTest extends ContextTestSupport {
    public void testTemporaryDestinationTypes() throws Exception {
        JmsEndpoint endpoint = getMandatoryEndpoint("activemq:test.queue", JmsEndpoint.class);
        JmsConfiguration configuration = endpoint.getConfiguration();
        JmsProviderMetadata providerMetadata = configuration.getProviderMetadata();
        assertNotNull("provider", providerMetadata);

        Class<? extends TemporaryQueue> queueType = endpoint.getTemporaryQueueType();
        Class<? extends TemporaryTopic> topicType = endpoint.getTemporaryTopicType();

View Full Code Here

Examples of org.apache.camel.component.jms.JmsConfiguration

        return new FutureHandler();
    }

    @Override
    public AbstractMessageListenerContainer createListenerContainer() {
        JmsConfiguration config = getConfiguration();
        String replyToSelectorName = getConfiguration().getReplyToDestinationSelectorName();

        AbstractMessageListenerContainer container =
            config.isUseVersion102()
                    ? (replyToSelectorName != null) ? new DefaultMessageListenerContainer102()
                           : new CamelDefaultMessageListenerContainer102()
                    : (replyToSelectorName != null) ? new DefaultMessageListenerContainer()
                           : new CamelDefaultMessageListenerContainer();

        container.setConnectionFactory(config.getListenerConnectionFactory());

        DestinationResolver resolver = config.getDestinationResolver();
        if (resolver == null) {
            resolver = container.getDestinationResolver();
        }

        container.setDestinationResolver(new DestinationResolverDelegate(resolver));
        container.setDestinationName(getConfiguration().getReplyTo());

        if (replyToSelectorName != null) {
            replyToSelectorValue = "ID:" + new BigInteger(24 * 8, new Random()).toString(16);
            container.setMessageSelector(replyToSelectorName + "='" + replyToSelectorValue + "'");
        } else {
            ((MessageSelectorComposer)container).addCorrelationID("ID:" + new BigInteger(24 * 8, new Random()).toString(16));
        }

        container.setAutoStartup(true);
        container.setMessageListener(this);
        container.setPubSubDomain(false);
        container.setSubscriptionDurable(false);
        ExceptionListener exceptionListener = config.getExceptionListener();
        if (exceptionListener != null) {
            container.setExceptionListener(exceptionListener);
        }
        container.setSessionTransacted(config.isTransacted());
        if (config.isTransacted()) {
            container.setSessionAcknowledgeMode(Session.SESSION_TRANSACTED);
        } else {
            if (config.getAcknowledgementMode() >= 0) {
                container.setSessionAcknowledgeMode(config.getAcknowledgementMode());
            } else if (config.getAcknowledgementModeName() != null) {
                container.setSessionAcknowledgeModeName(config.getAcknowledgementModeName());
            }
        }
        if (container instanceof DefaultMessageListenerContainer) {
            DefaultMessageListenerContainer defContainer = (DefaultMessageListenerContainer)container;
            defContainer.setConcurrentConsumers(1);
            defContainer.setCacheLevel(DefaultMessageListenerContainer.CACHE_SESSION);

            if (config.getReceiveTimeout() >= 0) {
                defContainer.setReceiveTimeout(config.getReceiveTimeout());
            }
            if (config.getRecoveryInterval() >= 0) {
                defContainer.setRecoveryInterval(config.getRecoveryInterval());
            }
            TaskExecutor taskExecutor = config.getTaskExecutor();
            if (taskExecutor != null) {
                defContainer.setTaskExecutor(taskExecutor);
            }
            PlatformTransactionManager tm = config.getTransactionManager();
            if (tm != null) {
                defContainer.setTransactionManager(tm);
            } else if (config.isTransacted()) {
                throw new IllegalArgumentException("Property transacted is enabled but a transactionManager was not injected!");
            }
            if (config.getTransactionName() != null) {
                defContainer.setTransactionName(config.getTransactionName());
            }
            if (config.getTransactionTimeout() >= 0) {
                defContainer.setTransactionTimeout(config.getTransactionTimeout());
            }
        }
        return container;
    }
View Full Code Here

Examples of org.apache.camel.component.jms.JmsConfiguration

    }

    @Test
    public void testSessionTransactedWithoutTransactionManager() throws Exception {
        JmsEndpoint endpoint = resolveMandatoryEndpoint("activemq:test.foo?transacted=true&lazyCreateTransactionManager=false");
        JmsConfiguration configuration = endpoint.getConfiguration();
       
        assertIsInstanceOf(ActiveMQConfiguration.class, configuration);

        assertTrue("The JMS sessions are not transacted!", endpoint.isTransacted());
        assertTrue("The JMS sessions are not transacted!", configuration.isTransacted());

        assertNull("A transaction manager has been lazy-created!", endpoint.getTransactionManager());
        assertNull("A transaction manager has been lazy-created!", configuration.getTransactionManager());
    }
View Full Code Here

Examples of org.apache.cxf.transport.jms.JMSConfiguration

        address.setJndiConnectionFactoryName("ConnectionFactory");
        List<JMSNamingPropertyType> props = address.getJMSNamingProperty();
        props.add(p1);
        props.add(p2);

        final JMSConfiguration jmsConfig = new JMSConfiguration();
       
        JndiTemplate jt = new JndiTemplate();
        jt.setEnvironment(JMSOldConfigHolder.getInitialContextEnv(address));
       
        JNDIConfiguration jndiConfig = new JNDIConfiguration();
        jndiConfig.setJndiConnectionFactoryName(address.getJndiConnectionFactoryName());
        jmsConfig.setJndiTemplate(jt);
        jmsConfig.setJndiConfig(jndiConfig);
       
        jmsConfig.setTargetDestination("dynamicQueues/SoapService8.replyto.queue");
        jmsConfig.setReplyDestination("dynamicQueues/SoapService8.reply.queue");
       
        final JmsTemplate jmsTemplate = JMSFactory.createJmsTemplate(jmsConfig, null);

        Thread t = new Thread() {
            public void run() {
                Destination destination = (Destination)jmsTemplate.execute(new SessionCallback() {
                    public Object doInJms(Session session) throws JMSException {
                        DestinationResolver resolv = jmsTemplate.getDestinationResolver();
                        return resolv.resolveDestinationName(session, jmsConfig.getTargetDestination(),
                                                             false);
                    }
                });
               
                final Message message = jmsTemplate.receive(destination);
                MessageCreator messageCreator = new MessageCreator() {
                    public Message createMessage(Session session) {
                        return message;
                    }
                };
                   
                destination = (Destination)jmsTemplate.execute(new SessionCallback() {
                    public Object doInJms(Session session) throws JMSException {
                        DestinationResolver resolv = jmsTemplate.getDestinationResolver();
                        return resolv.resolveDestinationName(session,
                                                             jmsConfig.getReplyDestination(),
                                                             false);
                    }
                });
                jmsTemplate.send(destination, messageCreator);
            }
View Full Code Here

Examples of org.apache.cxf.transport.jms.JMSConfiguration

    public void testNonAopTransaction() throws Exception {
        JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
        factory.setServiceClass(Greeter.class);
        factory.setAddress("jms://");

        JMSConfiguration jmsConfig = new JMSConfiguration();
        ConnectionFactory connectionFactory
            = new PooledConnectionFactory(broker.getBrokerURL());
        jmsConfig.setConnectionFactory(connectionFactory);
        jmsConfig.setTargetDestination("greeter.queue.noaop");
        jmsConfig.setPubSubDomain(false);
        jmsConfig.setUseJms11(true);

        JMSConfigFeature jmsConfigFeature = new JMSConfigFeature();
        jmsConfigFeature.setJmsConfig(jmsConfig);
        factory.getFeatures().add(jmsConfigFeature);
View Full Code Here

Examples of org.apache.cxf.transport.jms.JMSConfiguration

        JMSEndpoint endpoint = new JMSEndpoint();
        endpoint.setJndiInitialContextFactory("org.apache.activemq.jndi.ActiveMQInitialContextFactory");
        endpoint.setJndiURL(broker.getBrokerURL());
        endpoint.setJndiConnectionFactoryName("ConnectionFactory");

        final JMSConfiguration jmsConfig = new JMSConfiguration();       
        JndiTemplate jt = new JndiTemplate();
       
        jt.setEnvironment(JMSOldConfigHolder.getInitialContextEnv(endpoint));
       
        JNDIConfiguration jndiConfig = new JNDIConfiguration();
        jndiConfig.setJndiConnectionFactoryName(endpoint.getJndiConnectionFactoryName());
        jmsConfig.setJndiTemplate(jt);
        jmsConfig.setJndiConfig(jndiConfig);
       
        jmsConfig.setTargetDestination("dynamicQueues/SoapService7.replyto.queue");
        jmsConfig.setReplyDestination("dynamicQueues/SoapService7.reply.queue");
       
        final JmsTemplate jmsTemplate = JMSFactory.createJmsTemplate(jmsConfig, null);

        Thread t = new Thread() {
            public void run() {
                Destination destination = jmsTemplate.execute(new SessionCallback<Destination>() {
                    public Destination doInJms(Session session) throws JMSException {
                        DestinationResolver resolv = jmsTemplate.getDestinationResolver();
                        return resolv.resolveDestinationName(session, jmsConfig.getTargetDestination(),
                                                             false);
                    }
                });
               
                final Message message = jmsTemplate.receive(destination);
                MessageCreator messageCreator = new MessageCreator() {
                    public Message createMessage(Session session) {
                        return message;
                    }
                };
                   
                Destination destination2 = jmsTemplate
                    .execute(new SessionCallback<Destination>() {
                        public Destination doInJms(Session session) throws JMSException {
                            DestinationResolver resolv = jmsTemplate.getDestinationResolver();
                            return resolv.resolveDestinationName(session,
                                                             jmsConfig.getReplyDestination(),
                                                             false);
                        }
                    });
                jmsTemplate.send(destination2, messageCreator);
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.