JMSAppender implements PaxAppender { public void doAppend(final PaxLoggingEvent paxLoggingEvent) { if (exclude(paxLoggingEvent) || jmsConnectionFactory == null) { return; } Runnable worker = new Runnable() { public void run() { try { TextMessage message = getOrCreateSession().createTextMessage(); message.setText(format.toString(paxLoggingEvent)); MessageProducer producer = getOrCreatePublisher(); producer.send(message); } catch (JMSException e) { LOG.warn("Exception caught while sending log event - reinitializing JMS resources to recover",e); closeJMSResources(); } } }; executor.execute(worker); }  void close(); void onBind(ConnectionFactory service); void onUnbind(ConnectionFactory service); void doAppend(final PaxLoggingEvent paxLoggingEvent); void setJmsConnectionFactory(ConnectionFactory jmsConnectionFactory); void setDestinationName(String destinationName); void setFormat(String name);  }
@Test public void testLogstashAppender() throws InterruptedException { MockEndpoint events = getMockEndpoint("mock:events"); events.expectedMessageCount(1); appender.doAppend(MockEvents.createInfoEvent()); assertMockEndpointsSatisfied(); }