Package org.apache.activemq

Examples of org.apache.activemq.ActiveMQSession.createProducer()


        TextMessage received = (TextMessage) consumer.receive(receiveTimeout);
        assertNotNull("got request from sender ok", received);

        LOG.info("got request, sending reply");

        MessageProducer consumerProducer = consumerSession.createProducer(received.getJMSReplyTo());
        consumerProducer.send(consumerSession.createTextMessage("got " + received.getText()));
        // temp dest on reply broker tied to this connection, setOptimizedDispatch=true ensures
        // message gets delivered before destination is removed
        consumerConnection.close();
View Full Code Here


    protected void useConnectionWithBlobMessage(Connection connection) throws Exception {
        connection.setClientID(clientID);
        connection.start();
        ActiveMQSession session = (ActiveMQSession) connection.createSession(transacted, authMode);
        destination = createDestination();
        MessageProducer producer = session.createProducer(destination);
        for (int i = 0; i < MESSAGE_COUNT; i++) {
            BlobMessage message = session.createBlobMessage(new URL("http://foo.bar/test"));
            message.setIntProperty("counter", i);
            message.setJMSCorrelationID("MyCorrelationID");
            message.setJMSReplyTo(new ActiveMQQueue("MyReplyTo"));
View Full Code Here

    protected void useConnectionWithByteMessage(Connection connection) throws Exception {
        connection.setClientID(clientID);
        connection.start();
        ActiveMQSession session = (ActiveMQSession) connection.createSession(transacted, authMode);
        destination = createDestination();
        MessageProducer producer = session.createProducer(destination);
        for (int i = 0; i < MESSAGE_COUNT; i++) {
            BytesMessage message = session.createBytesMessage();
            message.writeBytes(("Message: " + i).getBytes());
            message.setIntProperty("counter", i);
            message.setJMSCorrelationID("MyCorrelationID");
View Full Code Here

        writer.append(content);
        writer.close();

        ActiveMQSession session = (ActiveMQSession) connection.createSession(
                false, Session.AUTO_ACKNOWLEDGE);
        MessageProducer producer = session.createProducer(destination);
        MessageConsumer consumer = session.createConsumer(destination);
        BlobMessage message = session.createBlobMessage(file);

        producer.send(message);
        Thread.sleep(1000);
View Full Code Here

        writer.append(content);
        writer.close();

        ActiveMQSession session = (ActiveMQSession) connection.createSession(
                false, Session.AUTO_ACKNOWLEDGE);
        MessageProducer producer = session.createProducer(destination);
        MessageConsumer consumer = session.createConsumer(destination);
        BlobMessage message = session.createBlobMessage(file);
        message.setName("fileName");

        producer.send(message);
View Full Code Here

        writer.append(content);
        writer.close();

        ActiveMQSession session = (ActiveMQSession) connection.createSession(
                false, Session.AUTO_ACKNOWLEDGE);
        MessageProducer producer = session.createProducer(destination);
        MessageConsumer consumer = session.createConsumer(destination);
        BlobMessage message = session.createBlobMessage(file);

        producer.send(message);
        Thread.sleep(1000);
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

            ActiveMQConnection connection = (ActiveMQConnection)connectionFactory.createConnection();
            connection.start();

            ActiveMQSession session = (ActiveMQSession)connection.createSession(transacted, Session.AUTO_ACKNOWLEDGE);
            Destination destination = session.createTopic("topic2");
            MessageProducer producer = session.createProducer(destination);
            producer.setDeliveryMode(DeliveryMode.PERSISTENT);
            for(int i=0;i<100;i++){
                TextMessage om=session.createTextMessage("hello from producer");
                producer.send(om);
            }
View Full Code Here

        ActiveMQConnectionFactory sendFactory = createConnectionFactory(a);
        ActiveMQConnection sendConnection = createConnection(sendFactory);

        ActiveMQSession sendSession = (ActiveMQSession)sendConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        MessageProducer producer = sendSession.createProducer(sendQ);
        ActiveMQTempQueue realReplyQ = (ActiveMQTempQueue) sendSession.createTemporaryQueue();
        TextMessage message = sendSession.createTextMessage("1");
        message.setJMSReplyTo(realReplyQ);
        producer.send(message);
        LOG.info("request sent");
View Full Code Here

        TextMessage received = (TextMessage) consumer.receive(receiveTimeout);
        assertNotNull("got request from sender ok", received);

        LOG.info("got request, sending reply");

        MessageProducer consumerProducer = consumerSession.createProducer(received.getJMSReplyTo());
        consumerProducer.send(consumerSession.createTextMessage("got " + received.getText()));
        // temp dest on reply broker tied to this connection, setOptimizedDispatch=true ensures
        // message gets delivered before destination is removed
        consumerConnection.close();
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.