Search in sources :

Example 61 with ActiveMQTextMessage

use of org.apache.activemq.command.ActiveMQTextMessage in project brave by openzipkin.

the class TracingMessageListenerTest method listener_reports_span_if_fails.

@Test
public void listener_reports_span_if_fails() {
    ActiveMQTextMessage message = new ActiveMQTextMessage();
    RuntimeException error = new RuntimeException("Test exception");
    onMessageConsumeFailed(message, error);
    testSpanHandler.takeRemoteSpan(CONSUMER);
    assertThat(testSpanHandler.takeLocalSpan().error()).isEqualTo(error);
}
Also used : ActiveMQTextMessage(org.apache.activemq.command.ActiveMQTextMessage) Test(org.junit.Test)

Example 62 with ActiveMQTextMessage

use of org.apache.activemq.command.ActiveMQTextMessage in project brave by openzipkin.

the class TracingMessageListenerTest method consumer_has_remote_service_name.

@Test
public void consumer_has_remote_service_name() {
    ActiveMQTextMessage message = new ActiveMQTextMessage();
    onMessageConsumed(message);
    assertThat(testSpanHandler.takeRemoteSpan(CONSUMER).remoteServiceName()).isEqualTo(jmsTracing.remoteServiceName);
    testSpanHandler.takeLocalSpan();
}
Also used : ActiveMQTextMessage(org.apache.activemq.command.ActiveMQTextMessage) Test(org.junit.Test)

Example 63 with ActiveMQTextMessage

use of org.apache.activemq.command.ActiveMQTextMessage in project brave by openzipkin.

the class TracingMessageListenerTest method retains_baggage_headers.

@Test
public void retains_baggage_headers() throws Exception {
    ActiveMQTextMessage message = new ActiveMQTextMessage();
    B3Propagation.B3_STRING.injector(SETTER).inject(parent, message);
    message.setStringProperty(BAGGAGE_FIELD_KEY, "");
    onMessageConsumed(message);
    assertThat(message.getProperties()).hasSize(// clears b3
    1).containsEntry(BAGGAGE_FIELD_KEY, "");
    testSpanHandler.takeRemoteSpan(CONSUMER);
    testSpanHandler.takeLocalSpan();
}
Also used : ActiveMQTextMessage(org.apache.activemq.command.ActiveMQTextMessage) Test(org.junit.Test)

Example 64 with ActiveMQTextMessage

use of org.apache.activemq.command.ActiveMQTextMessage in project brave by openzipkin.

the class TracingMessageListenerTest method listener_continues_parent_trace_single_header.

@Test
public void listener_continues_parent_trace_single_header() {
    tracingMessageListener = new TracingMessageListener(delegate, jmsTracing, false);
    ActiveMQTextMessage message = new ActiveMQTextMessage();
    setStringProperty(message, "b3", B3SingleFormat.writeB3SingleFormatWithoutParentId(parent));
    onMessageConsumed(message);
    // clearing headers ensures later work doesn't try to use the old parent
    assertNoProperties(message);
    assertChildOf(testSpanHandler.takeLocalSpan(), parent);
}
Also used : ActiveMQTextMessage(org.apache.activemq.command.ActiveMQTextMessage) Test(org.junit.Test)

Example 65 with ActiveMQTextMessage

use of org.apache.activemq.command.ActiveMQTextMessage in project brave by openzipkin.

the class TracingMessageListenerTest method reports_span_if_consume_fails_with_no_message.

@Test
public void reports_span_if_consume_fails_with_no_message() {
    ActiveMQTextMessage message = new ActiveMQTextMessage();
    RuntimeException error = new RuntimeException("Test exception");
    onMessageConsumeFailed(message, error);
    testSpanHandler.takeRemoteSpan(CONSUMER);
    assertThat(testSpanHandler.takeLocalSpan().error()).isEqualTo(error);
}
Also used : ActiveMQTextMessage(org.apache.activemq.command.ActiveMQTextMessage) Test(org.junit.Test)

Aggregations

ActiveMQTextMessage (org.apache.activemq.command.ActiveMQTextMessage)71 Test (org.junit.Test)36 TextMessage (javax.jms.TextMessage)16 ActiveMQQueue (org.apache.activemq.command.ActiveMQQueue)14 Message (javax.jms.Message)10 MessageProducer (javax.jms.MessageProducer)10 MessageConsumer (javax.jms.MessageConsumer)9 MessageId (org.apache.activemq.command.MessageId)9 JMSException (javax.jms.JMSException)7 ActiveMQBytesMessage (org.apache.activemq.command.ActiveMQBytesMessage)7 DestinationStatistics (org.apache.activemq.broker.region.DestinationStatistics)6 MessageReference (org.apache.activemq.broker.region.MessageReference)6 Queue (org.apache.activemq.broker.region.Queue)6 ActiveMQMapMessage (org.apache.activemq.command.ActiveMQMapMessage)6 ActiveMQObjectMessage (org.apache.activemq.command.ActiveMQObjectMessage)6 ActiveMQStreamMessage (org.apache.activemq.command.ActiveMQStreamMessage)6 ConsumerInfo (org.apache.activemq.command.ConsumerInfo)6 SystemUsage (org.apache.activemq.usage.SystemUsage)6 MutableSpan (brave.handler.MutableSpan)5 MessageNotWriteableException (javax.jms.MessageNotWriteableException)5