Package org.apache.cxf.transport.jms

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


        receiver.runAsync();

        EndpointInfo ei = new EndpointInfo();
        ei.setAddress(address);
        Bus bus = BusFactory.getDefaultBus();
        JMSConfiguration jmsConfig = JMSConfigFactory.createFromEndpointInfo(bus, ei, null);
        jmsConfig.setConnectionFactory(cf);
        JMSConduit conduit = new JMSConduit(new EndpointReferenceType(), jmsConfig, bus);

        Exchange exchange = new ExchangeImpl();
        exchange.setSynchronous(syncType == SyncType.sync);
        Message message = new MessageImpl();
View Full Code Here


   
    @Test
    public void testJMSMessageMarshal() throws IOException, JMSException {
        String testMsg = "Test Message";
        final byte[] testBytes = testMsg.getBytes(Charset.defaultCharset().name()); // TODO encoding
        JMSConfiguration jmsConfig = new JMSConfiguration();
        jmsConfig.setConnectionFactory(new ActiveMQConnectionFactory("vm://tesstMarshal?broker.persistent=false"));
       
        ResourceCloser closer = new ResourceCloser();
        try {
            Connection connection = JMSFactory.createConnection(jmsConfig);
            Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
View Full Code Here

    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);

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

                new ClassPathXmlApplicationContext("org/apache/cxf/systest/jms/tx/jms_server_config.xml");
            context.start();
           
            endpoint = new EndpointImpl(new GreeterImplWithTransaction());
            endpoint.setAddress("jms://");
            JMSConfiguration jmsConfig = new JMSConfiguration();
   
            ConnectionFactory connectionFactory
                = context.getBean("jmsConnectionFactory", ConnectionFactory.class);
            jmsConfig.setConnectionFactory(connectionFactory);
            jmsConfig.setTargetDestination("greeter.queue.noaop");
            jmsConfig.setSessionTransacted(true);
            jmsConfig.setPubSubDomain(false);
            jmsConfig.setCacheLevel(3);
   
            JMSConfigFeature jmsConfigFeature = new JMSConfigFeature();
            jmsConfigFeature.setJmsConfig(jmsConfig);
            endpoint.getFeatures().add(jmsConfigFeature);
            endpoint.publish();
View Full Code Here

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

        final JMSConfiguration jmsConfig = new JMSConfiguration();       
        JndiHelper jt = new JndiHelper(JMSOldConfigHolder.getInitialContextEnv(endpoint));
       
        JNDIConfiguration jndiConfig = new JNDIConfiguration();
        jndiConfig.setJndiConnectionFactoryName(endpoint.getJndiConnectionFactoryName());
        jmsConfig.setJndiTemplate(jt);
        jmsConfig.setJndiConfig(jndiConfig);
       
        TestReceiver receiver = new TestReceiver(jmsConfig.getConnectionFactory(),
                                                 "dynamicQueues/SoapService7.replyto.queue", false);
        receiver.setStaticReplyQueue("dynamicQueues/SoapService7.reply.queue");
        receiver.runAsync();
       
        QName serviceName = new QName("http://apache.org/hello_world_doc_lit", "SOAPService7");
View Full Code Here

        String address = testcase.getAddress();
       
        EndpointInfo endpointInfo = new EndpointInfo();
        endpointInfo.setAddress(address);
        JMSOldConfigHolder oldConfig = new JMSOldConfigHolder();
        JMSConfiguration jmsConfig = oldConfig
            .createJMSConfigurationFromEndpointInfo(staticBus, endpointInfo , null, true);
       
        ResourceCloser closer = new ResourceCloser();
        try {
            Connection connection = closer.register(JMSFactory.createConnection(jmsConfig));
            connection.start();
            Session session = closer.register(connection.createSession(false, Session.AUTO_ACKNOWLEDGE));
            Destination targetDest = jmsConfig.getTargetDestination(session);
            Destination replyToDestination = jmsConfig.getReplyToDestination(session, null);
            JMSSender sender = JMSFactory.createJmsSender(jmsConfig, null);
            Message jmsMessage = JMSTestUtil.buildJMSMessageFromTestCase(testcase, session, replyToDestination);
            sender.sendMessage(closer, session, targetDest, jmsMessage);
            Message replyMessage = JMSUtil.receive(session, replyToDestination,
                                                   jmsMessage.getJMSMessageID(), 10000, true);
View Full Code Here

        JMSEndpoint endpoint = new JMSEndpoint();
        endpoint.setJndiInitialContextFactory("org.apache.activemq.jndi.ActiveMQInitialContextFactory");
        endpoint.setJndiURL("tcp://localhost:" + JMS_PORT);
        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() {
                @SuppressWarnings("unchecked")
                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;
                    }
                };
                   
                @SuppressWarnings("unchecked")
                Destination destination2 = (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(destination2, messageCreator);
            }
View Full Code Here

        // todo messagebody
    }
   
    public void twoWayTestWithCreateMessage(final TestCaseType testcase) throws Exception {
        String address = testcase.getAddress();
        JMSConfiguration jmsConfig = JMSTestUtil.getInitJMSConfiguration(address);
        final JmsTemplate jmsTemplate = JMSFactory.createJmsTemplate(jmsConfig, null);
       
        final Destination replyToDestination = JMSFactory.resolveOrCreateDestination(jmsTemplate,
                                                                                     null, false);
        class JMSConduitMessageCreator implements MessageCreator {
            private javax.jms.Message jmsMessage;

            public javax.jms.Message createMessage(Session session) throws JMSException {
                jmsMessage = JMSTestUtil.buildJMSMessageFromTestCase(testcase, session, replyToDestination);
                return jmsMessage;
            }

            public String getMessageID() {
                if (jmsMessage != null) {
                    try {
                        return jmsMessage.getJMSMessageID();
                    } catch (JMSException e) {
                        return null;
                    }
                }
                return null;
            }
        }
        JMSConduitMessageCreator messageCreator = new JMSConduitMessageCreator();   

        jmsTemplate.send(jmsConfig.getTargetDestination(), messageCreator);
        String messageId = messageCreator.getMessageID();

        String messageSelector = "JMSCorrelationID = '" + messageId + "'";
        javax.jms.Message replyMessage = jmsTemplate.receiveSelected(replyToDestination,
                                                                     messageSelector);
View Full Code Here

        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

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

        JMSConfiguration jmsConfig = new JMSConfiguration();
        ConnectionFactory connectionFactory
            = new org.apache.activemq.ActiveMQConnectionFactory("tcp://localhost:" + JMS_PORT);
        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

TOP

Related Classes of org.apache.cxf.transport.jms.JMSConfiguration

Copyright © 2018 www.massapicom. 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.