Package javax.jms

Examples of javax.jms.Session.createQueue()


    public void testClientConsumeFromNamedQueueFailure() throws NamingException, Exception
    {
        Connection conn = getConnection("test", "client", "guest");
        Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
        conn.start();
        Destination dest = sess.createQueue("IllegalQueue");

        try
        {
            sess.createConsumer(dest);
View Full Code Here


    public void testClientCreateNamedQueueFailure() throws NamingException, JMSException, AMQException, Exception
    {
        Connection conn = getConnection("test", "client", "guest");
        Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
        conn.start();
        Destination dest = sess.createQueue("IllegalQueue");

        try
        {
            //Create a Named Queue as side effect
            sess.createConsumer(dest);
View Full Code Here

        Session sess = conn.createSession(true, Session.SESSION_TRANSACTED);

        conn.start();

        MessageProducer sender = sess.createProducer(sess.createQueue("example.RequestQueue"));

        sender.send(sess.createTextMessage("test"));

        //Send the message using a transaction as this will allow us to retrieve any errors that occur on the broker.
        sess.commit();
View Full Code Here

    public void testRequestResponseSuccess() throws Exception
    {
        //Set up the Server
        Connection serverConnection = getConnection("test", "server", "guest");
        Session serverSession = serverConnection.createSession(true, Session.SESSION_TRANSACTED);
        Queue requestQueue = serverSession.createQueue("example.RequestQueue");
        MessageConsumer server = serverSession.createConsumer(requestQueue);
        serverConnection.start();

        //Set up the consumer
        Connection clientConnection = getConnection("test", "client", "guest");
View Full Code Here

                connection = connectionFactory.createConnection();
            }
            connection.setClientID(broker.getContainer().getName());
            connection.start();
            Session inboundSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
            Queue queue = inboundSession.createQueue(INBOUND_PREFIX + broker.getContainer().getName());
            MessageConsumer inboundQueue = inboundSession.createConsumer(queue);
            inboundQueue.setMessageListener(this);
        } catch (JMSException e) {
            log.error("Failed to initialize JMSFlow", e);
            throw new JBIException(e);
View Full Code Here

        }
        try {
            String key = EndpointSupport.getKey(event.getEndpoint());
            if (!consumerMap.containsKey(key)) {
                Session inboundSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
                Queue queue = inboundSession.createQueue(INBOUND_PREFIX + key);
                MessageConsumer consumer = inboundSession.createConsumer(queue);
                consumer.setMessageListener(this);
                consumerMap.put(key, consumer);
            }
            if (broadcast) {
View Full Code Here

        }
        try {
            String key = event.getComponent().getName();
            if (!consumerMap.containsKey(key)) {
                Session inboundSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
                Queue queue = inboundSession.createQueue(INBOUND_PREFIX + key);
                MessageConsumer consumer = inboundSession.createConsumer(queue);
                consumer.setMessageListener(this);
                consumerMap.put(key, consumer);
            }
        } catch (Exception e) {
View Full Code Here

                }
            }

            Session inboundSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
            try {
                Queue queue = inboundSession.createQueue(destination);
                ObjectMessage msg = inboundSession.createObjectMessage(me);
                MessageProducer queueProducer = inboundSession.createProducer(queue);
                queueProducer.send(msg);
            } finally {
                inboundSession.close();
View Full Code Here

                if (endpoint.getJndiDestinationName() != null) {
                    destination = (Destination) ctx.lookup(endpoint.getJndiDestinationName());
                } else if (endpoint.getJmsProviderDestinationName() != null) {
                    if (STYLE_QUEUE.equals(endpoint.getDestinationStyle())) {
                        destination = session.createQueue(endpoint.getJmsProviderDestinationName());
                    } else {
                        destination = session.createTopic(endpoint.getJmsProviderDestinationName());
                    }
                } else {
                    throw new IllegalStateException("No destination provided");
View Full Code Here

                if (endpoint.getJndiReplyToName() != null) {
                    permanentReplyToDestination = (Destination) ctx.lookup(endpoint.getJndiReplyToName());
                } else if (endpoint.getJmsProviderReplyToName() != null) {
                    if (destination instanceof Queue) {
                        permanentReplyToDestination = session.createQueue(endpoint.getJmsProviderReplyToName());
                    } else {
                        permanentReplyToDestination = session.createTopic(endpoint.getJmsProviderReplyToName());
                    }
                }
            }
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.