Java Code Examples for javax.jms.MessageProducer#getDestination()
The following examples show how to use
javax.jms.MessageProducer#getDestination() .
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: JmsMessageProducerInstrumentation.java From apm-agent-java with Apache License 2.0 | 6 votes |
@Advice.OnMethodEnter(suppress = Throwable.class) @Nullable public static Span beforeSend(@Advice.Argument(0) final Message message, @Advice.This final MessageProducer producer) { //noinspection ConstantConditions - the Advice must be invoked only if the BaseJmsInstrumentation constructor was invoked JmsInstrumentationHelper<Destination, Message, MessageListener> helper = jmsInstrHelperManager.getForClassLoaderOfClass(MessageProducer.class); try { Destination destination = producer.getDestination(); if (helper != null) { return helper.startJmsSendSpan(destination, message); } } catch (JMSException e) { logger.warn("Failed to retrieve message's destination", e); } return null; }
Example 2
Source File: MessageProducerTest.java From activemq-artemis with Apache License 2.0 | 6 votes |
@Test public void testGetDestinationOnClosedProducer() throws Exception { Connection pconn = createConnection(); try { Session ps = pconn.createSession(false, Session.AUTO_ACKNOWLEDGE); MessageProducer p = ps.createProducer(ActiveMQServerTestCase.topic1); p.close(); try { p.getDestination(); ProxyAssertSupport.fail("should throw exception"); } catch (javax.jms.IllegalStateException e) { // OK } } finally { pconn.close(); } }
Example 3
Source File: MessageProducerTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
@Test public void testGetDestination() throws Exception { Connection pconn = createConnection(); try { Session ps = pconn.createSession(false, Session.AUTO_ACKNOWLEDGE); MessageProducer p = ps.createProducer(ActiveMQServerTestCase.topic1); Destination dest = p.getDestination(); ProxyAssertSupport.assertEquals(dest, ActiveMQServerTestCase.topic1); } finally { pconn.close(); } }