List of usage examples for javax.jms Connection getExceptionListener
ExceptionListener getExceptionListener() throws JMSException;
From source file:org.seedstack.jms.internal.JmsPlugin.java
private MessageConsumer createMessageConsumer(MessageListenerDefinition messageListenerDefinition) throws JMSException { LOGGER.debug("Creating JMS consumer for listener {}", messageListenerDefinition.getName()); MessageConsumer consumer;/*from w w w.j ava2s. c o m*/ Session session = messageListenerDefinition.getSession(); if (StringUtils.isNotBlank(messageListenerDefinition.getSelector())) { consumer = session.createConsumer(messageListenerDefinition.getDestination(), messageListenerDefinition.getSelector()); } else { consumer = session.createConsumer(messageListenerDefinition.getDestination()); } MessagePoller messagePoller; if (messageListenerDefinition.getPoller() != null) { try { LOGGER.debug("Creating poller for JMS listener {}", messageListenerDefinition.getName()); Connection connection = connections.get(messageListenerDefinition.getConnectionName()); messagePoller = messageListenerDefinition.getPoller().newInstance(); messagePoller.setSession(session); messagePoller.setMessageConsumer(consumer); messagePoller.setMessageListener(new MessageListenerAdapter(messageListenerDefinition.getName())); if (connection instanceof ManagedConnection) { messagePoller.setExceptionListener((ExceptionListener) connection); } else { messagePoller.setExceptionListener(connection.getExceptionListener()); } } catch (Exception e) { throw SeedException.wrap(e, JmsErrorCodes.UNABLE_TO_CREATE_POLLER).put("pollerClass", messageListenerDefinition.getPoller()); } pollers.put(messageListenerDefinition.getName(), messagePoller); } else { consumer.setMessageListener(new MessageListenerAdapter(messageListenerDefinition.getName())); } return consumer; }