Package org.apache.activemq

Examples of org.apache.activemq.ActiveMQMessageProducer


    public void send(Destination destination, Message message, int deliveryMode, int priority, long timeToLive) throws JMSException {
        if (destination == null) {
            destination = this.destination;
        }
        ActiveMQMessageProducer messageProducer = getMessageProducer();

        // just in case let only one thread send at once
        synchronized (messageProducer) {
            messageProducer.send(destination, message, deliveryMode, priority, timeToLive);
        }
    }
View Full Code Here


    public void send(Destination destination, Message message, int deliveryMode, int priority, long timeToLive) throws JMSException {
        if (destination == null) {
            destination = this.destination;
        }
        ActiveMQMessageProducer messageProducer = getMessageProducer();

        // just in case let only one thread send at once
        synchronized (messageProducer) {
            messageProducer.send(destination, message, deliveryMode, priority, timeToLive);
        }
    }
View Full Code Here

        // lets make a snapshot before we process them
        Object[] producerArray = producers.toArray();
        int size = producerArray.length;
        JMSProducerStatsImpl[] answer = new JMSProducerStatsImpl[size];
        for (int i = 0; i < size; i++) {
            ActiveMQMessageProducer producer = (ActiveMQMessageProducer) producerArray[i];
            answer[i] = producer.getProducerStats();
        }
        return answer;
    }
View Full Code Here

    public void send(Destination destination, Message message, int deliveryMode, int priority, long timeToLive) throws JMSException {
        if (destination == null) {
            destination = this.destination;
        }
        ActiveMQMessageProducer messageProducer = getMessageProducer();

        // just in case let only one thread send at once
        synchronized (messageProducer) {
            messageProducer.send(destination, message, deliveryMode, priority, timeToLive);
        }
    }
View Full Code Here

    @Override
    public void send(Destination destination, Message message, int deliveryMode, int priority, long timeToLive) throws JMSException {
        if (destination == null) {
            destination = this.destination;
        }
        ActiveMQMessageProducer messageProducer = getMessageProducer();

        // just in case let only one thread send at once
        synchronized (messageProducer) {
            messageProducer.send(destination, message, deliveryMode, priority, timeToLive);
        }
    }
View Full Code Here

       // Test that a normal session doesn't operate on XASession state.
       Connection connection2 = connectionFactory.createConnection();
       connection2.start();
       ActiveMQSession session2 = (ActiveMQSession) connection2.createSession(true, Session.AUTO_ACKNOWLEDGE);
       Destination destination = new ActiveMQQueue(destinationName);
       ActiveMQMessageProducer producer2 = (ActiveMQMessageProducer) session2.createProducer(destination);
       producer2.send(session2.createTextMessage("Local-TX"));

       if (session2.isTransacted()) {
           session2.rollback();
       }
View Full Code Here

                session = (ActiveMQSession) connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

                destination = session.createQueue(this.destinationName);

                // Create a MessageProducer from the Session to the Topic or Queue
                ActiveMQMessageProducer producer = (ActiveMQMessageProducer) session.createProducer(destination);
                producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);

                for (int i = 0; i < (producerMessages); i++) {
                    TextMessage message = (TextMessage) session.createTextMessage();
                    message.setLongProperty("TestTime", (System.currentTimeMillis()));
                    try {
                        producer.send(message);
                        LOG.info("Producer (" + destinationName + ")\n" + message.getJMSMessageID() + " = sent messageId\n");

                        latch.countDown();
                        LOG.info(" Latch count  " + latch.getCount());
                        LOG.info("Producer message list size = " + messageList.keySet().size());
View Full Code Here

                    destination = session.createQueue(this.destinationName);
                }

                // Create a MessageProducer from the Session to the Topic or
                // Queue
                ActiveMQMessageProducer producer = (ActiveMQMessageProducer) session.createProducer(destination);
                producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);

                for (int i = 0; i < numberMessages; i++) {
                    TextMessage message = (TextMessage) session.createTextMessage("I am a message :: " + String.valueOf(i));
                    try {
                        producer.send(message);

                    } catch (Exception deeperException) {
                        LOG.info("Producer for destination (" + destinationName + ") Caught: " + deeperException);
                    }
View Full Code Here

        // lets make a snapshot before we process them
        Object[] producerArray = producers.toArray();
        int size = producerArray.length;
        JMSProducerStatsImpl[] answer = new JMSProducerStatsImpl[size];
        for (int i = 0; i < size; i++) {
            ActiveMQMessageProducer producer = (ActiveMQMessageProducer)producerArray[i];
            answer[i] = producer.getProducerStats();
        }
        return answer;
    }
View Full Code Here

                            activeMQConnection.start();
                            ActiveMQSession activeMQSession = (ActiveMQSession) activeMQConnection.createSession(false, Session.CLIENT_ACKNOWLEDGE);

                            ActiveMQQueue dest = new ActiveMQQueue("queue-" + i + "-"
                                    + AMQ5212Test.class.getSimpleName());
                            ActiveMQMessageProducer activeMQMessageProducer = (ActiveMQMessageProducer) activeMQSession.createProducer(dest);
                            if (demand) {
                                // create demand so page in will happen
                                activeMQSession.createConsumer(dest);
                            }
                            ActiveMQTextMessage message = new ActiveMQTextMessage();
                            message.setDestination(dest);
                            activeMQMessageProducer.send(message, null);

                            // send a duplicate
                            activeMQConnection.syncSendPacket(message);
                            activeMQConnection.close();
View Full Code Here

TOP

Related Classes of org.apache.activemq.ActiveMQMessageProducer

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.