Package org.hornetq.api.core.client

Examples of org.hornetq.api.core.client.ClientProducer


    public void exceptionCaught(ClientSession session, Throwable cause) throws Exception {
//      handler.exceptionCaught(new HornetQSessionWriter(session, message), cause);
    }

    public void messageReceived(ClientSession session, Object message, String producerId) throws Exception {
      ClientProducer producer = producers.get(producerId);
      if (producer==null) {
        producer = session.createProducer(producerId);
      }
    handler.messageReceived(new HornetQSessionWriter(session, producer), message);
    }
View Full Code Here


        this.handler = new TaskServerHandler(service, systemEventListener);
        this.producers = new HashMap<String, ClientProducer>();
    }

    public void messageReceived(ClientSession session, Object message, String destination) throws Exception {
      ClientProducer producer = producers.get(destination);
      if (producer==null) {
        producer = session.createProducer(destination);
        producers.put(destination, producer);
      }
    handler.messageReceived(new HornetQSessionWriter(session, producer), message);
View Full Code Here

            }

            ClientSession session = null;
            try {
               session = sf.createSession();
               ClientProducer producer = session.createProducer(queueName);
               ClientMessage message = session.createMessage(false);

               final String propName = "myprop";
               message.putStringProperty(propName, "Hello sent at " + new Date());
               System.out.println("Sending the message.");

               producer.send(message);

               ClientConsumer messageConsumer = session.createConsumer(queueName);
               session.start();

               ClientMessage messageReceived = messageConsumer.receive(1000);
View Full Code Here

        coreSession.close();
    }

    public void sendMessage(String txt) throws Exception {
        System.out.println("-----> Attempting to send message");
        ClientProducer producer = session.createProducer(QUEUE_EXAMPLE_QUEUE);
        ClientMessage message = session.createMessage(false);

        message.putStringProperty(BODY, "'" + txt + "' sent at " + new Date());
        System.out.println("-----> Sending message");
        producer.send(message);
    }
View Full Code Here

      SimpleString otherAddress = RandomUtil.randomSimpleString();
      SimpleString otherQueue = RandomUtil.randomSimpleString();

      session.createQueue(address, queue, null, false);
      session.createQueue(otherAddress, otherQueue, null, false);
      ClientProducer producer = session.createProducer(address);

      // send 2 messages on queue
      producer.send(session.createMessage(false));
      producer.send(session.createMessage(false));

      QueueControl queueControl = createManagementControl(address, queue);
      QueueControl otherQueueControl = createManagementControl(otherAddress, otherQueue);
      Assert.assertEquals(2, queueControl.getMessageCount());
      Assert.assertEquals(0, otherQueueControl.getMessageCount());
View Full Code Here

      SimpleString address = RandomUtil.randomSimpleString();
      SimpleString queue = RandomUtil.randomSimpleString();
      SimpleString unknownQueue = RandomUtil.randomSimpleString();

      session.createQueue(address, queue, null, false);
      ClientProducer producer = session.createProducer(address);

      // send 2 messages on queue
      producer.send(session.createMessage(false));

      QueueControl queueControl = createManagementControl(address, queue);
      Assert.assertEquals(1, queueControl.getMessageCount());

      // the message IDs are set on the server
View Full Code Here

      SimpleString address = RandomUtil.randomSimpleString();
      SimpleString queue = RandomUtil.randomSimpleString();

      session.createQueue(address, queue, null, false);
      ClientProducer producer = session.createProducer(address);

      // send on queue
      ClientMessage matchingMessage = session.createMessage(false);
      matchingMessage.putLongProperty(key, matchingValue);
      producer.send(matchingMessage);
      ClientMessage unmatchingMessage = session.createMessage(false);
      unmatchingMessage.putLongProperty(key, unmatchingValue);
      producer.send(unmatchingMessage);

      QueueControl queueControl = createManagementControl(address, queue);
      Assert.assertEquals(2, queueControl.getMessageCount());

      // removed matching messages to otherQueue
View Full Code Here

      SimpleString address = RandomUtil.randomSimpleString();
      SimpleString queue = RandomUtil.randomSimpleString();

      session.createQueue(address, queue, null, false);
      ClientProducer producer = session.createProducer(address);

      // send on queue
      ClientMessage matchingMessage = session.createMessage(false);
      matchingMessage.putLongProperty(key, matchingValue);
      producer.send(matchingMessage);
      ClientMessage unmatchingMessage = session.createMessage(false);
      unmatchingMessage.putLongProperty(key, unmatchingValue);
      producer.send(unmatchingMessage);

      QueueControl queueControl = createManagementControl(address, queue);
      Assert.assertEquals(2, queueControl.getMessageCount());

      // removed matching messages to otherQueue
View Full Code Here

   {
      SimpleString address = RandomUtil.randomSimpleString();
      SimpleString queue = RandomUtil.randomSimpleString();

      session.createQueue(address, queue, null, false);
      ClientProducer producer = session.createProducer(address);

      // send on queue
      producer.send(session.createMessage(false));
      producer.send(session.createMessage(false));

      QueueControl queueControl = createManagementControl(address, queue);
      Assert.assertEquals(2, queueControl.getMessageCount());

      // removed matching messages to otherQueue
View Full Code Here

   {
      SimpleString address = RandomUtil.randomSimpleString();
      SimpleString queue = RandomUtil.randomSimpleString();

      session.createQueue(address, queue, null, false);
      ClientProducer producer = session.createProducer(address);

      // send on queue
      producer.send(session.createMessage(false));
      producer.send(session.createMessage(false));

      QueueControl queueControl = createManagementControl(address, queue);
      Assert.assertEquals(2, queueControl.getMessageCount());

      // removed matching messages to otherQueue
View Full Code Here

TOP

Related Classes of org.hornetq.api.core.client.ClientProducer

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.