Package javax.jms

Examples of javax.jms.Destination


            String topicBase  = "qmf." + _domain + ".topic";
            _syncSession = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

            // Create a MessageProducer for the QMF topic address used to broadcast requests
            Destination topicAddress = _syncSession.createQueue(topicBase);
            _broadcaster = _syncSession.createProducer(topicAddress);

            // If Asynchronous Behaviour is enabled we create the Queues used to receive async responses
            // Data Indications, QMF Events, Heartbeats etc. from the broker (or other Agents).
            if (!_disableEvents)
            {
                // TODO it should be possible to bind _eventConsumer and _asyncResponder to the same queue
                // if I can figure out the correct AddressString to use, probably not a big deal though.

                _asyncSession = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

                // Set up MessageListener on the Event Address
                Destination eventAddress = _asyncSession.createQueue(topicBase + "/agent.ind.#" + eventAddressOptions);
                _eventConsumer = _asyncSession.createConsumer(eventAddress);
                _eventConsumer.setMessageListener(this);

                // Create the asynchronous JMSReplyTo _replyAddress and MessageConsumer
                _asyncReplyAddress = _asyncSession.createQueue(_address + ".async" + asyncReplyAddressOptions);
                _asyncResponder = _asyncSession.createConsumer(_asyncReplyAddress);
                _asyncResponder.setMessageListener(this);
            }

            // I've extended the synchronized block to include creating the _requester and _responder. I don't believe
            // that this is strictly necessary, but it stops findbugs moaning about inconsistent synchronization
            // so makes sense if only to get that warm and fuzzy feeling of keeping findbugs happy :-)
            synchronized(this)
            {
                // Create a MessageProducer for the QMF direct address, mainly used for request/response
                Destination directAddress = _syncSession.createQueue("qmf." + _domain + ".direct");
                _requester = _syncSession.createProducer(directAddress);

                // Create the JMSReplyTo _replyAddress and MessageConsumer
                _replyAddress = _syncSession.createQueue(_address + syncReplyAddressOptions);
                _responder = _syncSession.createConsumer(_replyAddress);
View Full Code Here


            }
        }

        try
        {
            Destination destination = (replyHandle == null) ? _replyAddress : _asyncReplyAddress;
            MapMessage request = _syncSession.createMapMessage();
            request.setJMSReplyTo(destination);
            request.setJMSCorrelationID(replyHandle);
            request.setStringProperty("x-amqp-0-10.app-id", "qmf2");
            request.setStringProperty("method", "request");
View Full Code Here

    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

        {
            return null;
        }
        else
        {
            Destination dest = _destinationCache.get(replyTo);
            if (dest == null)
            {
                String exchange = replyTo.getExchange();
                String routingKey = replyTo.getRoutingKey();
View Full Code Here

        return _messageProps.getContentEncoding();
    }

    public String getReplyToString()
    {
        Destination replyTo = getJMSReplyTo();
        if(replyTo != null)
        {
            return ((AMQDestination)replyTo).toURL();
        }
        else
View Full Code Here

    private void runTest(String exchangeName, String queueName, String routingKey, String data) throws Exception
    {
        Connection con =  getConnection();
        Session sess = con.createSession(false, javax.jms.Session.AUTO_ACKNOWLEDGE);
        final Destination dest = getDestination(exchangeName, routingKey, queueName);

        final MessageConsumer msgCons = sess.createConsumer(dest);
        con.start();

        // Send data
View Full Code Here

    }

    private void consumerCreateAndClose(boolean pubSub, boolean durable) throws JMSException
    {
        Session session = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        Destination destination = null;
        MessageConsumer consumer = null;
        if (pubSub)
        {
            destination = session.createTopic(getTestQueueName());
            if (durable)
View Full Code Here

    private Message produceMessage(int acknowledgeMode, boolean pubSub, boolean mandatory, boolean immediate)
            throws JMSException
    {
        Session session = _connection.createSession(acknowledgeMode == Session.SESSION_TRANSACTED, acknowledgeMode);
        Destination destination = null;
        if (pubSub)
        {
            destination = session.createTopic(getTestQueueName());
        }
        else
View Full Code Here

       
        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(),
View Full Code Here

TOP

Related Classes of javax.jms.Destination

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.