Java Code Examples for org.apache.activemq.command.ActiveMQTextMessage#setDestination()

The following examples show how to use org.apache.activemq.command.ActiveMQTextMessage#setDestination() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BrokerNetworkWithStuckMessagesTest.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
protected Message createMessage(ProducerInfo producerInfo, ActiveMQDestination destination) {
   ActiveMQTextMessage message = new ActiveMQTextMessage();
   message.setMessageId(new MessageId(producerInfo, ++msgIdGenerator));
   message.setDestination(destination);
   message.setPersistent(false);
   try {
      message.setText("Test Message Payload.");
   } catch (MessageNotWriteableException e) {
   }
   return message;
}
 
Example 2
Source File: QueueOptimizedDispatchExceptionTest.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
private Message getMessage(int i) throws Exception {
   ActiveMQTextMessage message = new ActiveMQTextMessage();
   message.setMessageId(new MessageId(mesageIdRoot + i));
   message.setDestination(destination);
   message.setPersistent(false);
   message.setResponseRequired(true);
   message.setText("Msg:" + i + " " + text);
   assertEquals(message.getMessageId().getProducerSequenceId(), i);
   return message;
}
 
Example 3
Source File: StoreQueueCursorNoDuplicateTest.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
private ActiveMQTextMessage getMessage(int i) throws Exception {
   ActiveMQTextMessage message = new ActiveMQTextMessage();
   MessageId id = new MessageId(mesageIdRoot + i);
   id.setBrokerSequenceId(i);
   id.setProducerSequenceId(i);
   message.setMessageId(id);
   message.setDestination(destination);
   message.setPersistent(true);
   message.setResponseRequired(true);
   message.setText("Msg:" + i + " " + text);
   assertEquals(message.getMessageId().getProducerSequenceId(), i);
   return message;
}
 
Example 4
Source File: StoreQueueCursorOrderTest.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
private ActiveMQTextMessage getMessage(int i) throws Exception {
   ActiveMQTextMessage message = new ActiveMQTextMessage();
   MessageId id = new MessageId(mesageIdRoot + i);
   id.setBrokerSequenceId(i);
   id.setProducerSequenceId(i);
   message.setMessageId(id);
   message.setDestination(destination);
   message.setPersistent(true);
   message.setResponseRequired(true);
   message.setText("Msg:" + i + " " + text);
   assertEquals(message.getMessageId().getProducerSequenceId(), i);
   return message;
}
 
Example 5
Source File: QueueDuplicatesFromStoreTest.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
private Message getMessage(int i) throws Exception {
   ActiveMQTextMessage message = new ActiveMQTextMessage();
   message.setMessageId(new MessageId(mesageIdRoot + i));
   message.setDestination(destination);
   message.setPersistent(true);
   message.setResponseRequired(true);
   message.setText("Msg:" + i + " " + text);
   assertEquals(message.getMessageId().getProducerSequenceId(), i);
   return message;
}
 
Example 6
Source File: BrokerTestSupport.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
protected Message createMessage(ProducerInfo producerInfo, ActiveMQDestination destination) {
   ActiveMQTextMessage message = new ActiveMQTextMessage();
   message.setMessageId(new MessageId(producerInfo, ++msgIdGenerator));
   message.setDestination(destination);
   message.setPersistent(false);
   try {
      message.setText("Test Message Payload.");
   } catch (MessageNotWriteableException e) {
   }
   return message;
}
 
Example 7
Source File: UdpTestSupport.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
protected void assertSendTextMessage(ActiveMQDestination destination,
                                     String text) throws MessageNotWriteableException {
   large = true;

   ActiveMQTextMessage expected = new ActiveMQTextMessage();

   expected.setText(text);
   expected.setDestination(destination);

   try {
      LOG.info("About to send message of type: " + expected.getClass());
      producer.oneway(expected);

      // lets send a dummy command to ensure things don't block if we
      // discard the last one
      // keepalive does not have a commandId...
      // producer.oneway(new KeepAliveInfo());
      producer.oneway(new ProducerInfo());
      producer.oneway(new ProducerInfo());

      Command received = assertCommandReceived();
      assertTrue("Should have received an ActiveMQTextMessage but was: " + received, received instanceof ActiveMQTextMessage);
      ActiveMQTextMessage actual = (ActiveMQTextMessage) received;

      assertEquals("getDestination", expected.getDestination(), actual.getDestination());
      assertEquals("getText", expected.getText(), actual.getText());

      LOG.info("Received text message with: " + actual.getText().length() + " character(s)");
   } catch (Exception e) {
      LOG.info("Caught: " + e);
      e.printStackTrace();
      fail("Failed to send to transport: " + e);
   }
}
 
Example 8
Source File: FanoutTransportBrokerTest.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
protected Message createMessage(ProducerInfo producerInfo, ActiveMQDestination destination) {
   ActiveMQTextMessage message = new ActiveMQTextMessage();
   message.setMessageId(new MessageId(producerInfo, ++msgIdGenerator));
   message.setDestination(destination);
   message.setPersistent(false);
   try {
      message.setText("Test Message Payload.");
   } catch (MessageNotWriteableException e) {
   }
   return message;
}
 
Example 9
Source File: FailoverTransportBrokerTest.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
protected Message createMessage(ProducerInfo producerInfo, ActiveMQDestination destination) {
   ActiveMQTextMessage message = new ActiveMQTextMessage();
   message.setMessageId(new MessageId(producerInfo, ++msgIdGenerator));
   message.setDestination(destination);
   message.setPersistent(false);
   try {
      message.setText("Test Message Payload.");
   } catch (MessageNotWriteableException e) {
   }
   return message;
}
 
Example 10
Source File: TracingMessageListenerTest.java    From brave with Apache License 2.0 5 votes vote down vote up
@Test public void tags_consumer_span_but_not_listener() {
  ActiveMQTextMessage message = new ActiveMQTextMessage();
  message.setDestination(createDestination("foo", QUEUE_TYPE));
  onMessageConsumed(message);

  assertThat(testSpanHandler.takeRemoteSpan(CONSUMER).tags()).containsEntry("jms.queue", "foo");
  assertThat(testSpanHandler.takeLocalSpan().tags()).isEmpty();
}
 
Example 11
Source File: TracingMessageListenerTest.java    From brave with Apache License 2.0 5 votes vote down vote up
@Test public void listener_has_no_tags_when_header_present() {
  tracingMessageListener =
    new TracingMessageListener(delegate, jmsTracing, false);

  ActiveMQTextMessage message = new ActiveMQTextMessage();
  setStringProperty(message, "b3", B3SingleFormat.writeB3SingleFormatWithoutParentId(parent));
  message.setDestination(createDestination("foo", QUEUE_TYPE));
  onMessageConsumed(message);

  assertThat(testSpanHandler.takeLocalSpan().tags()).isEmpty();
}