List of usage examples for org.springframework.jms.listener SimpleMessageListenerContainer SimpleMessageListenerContainer
SimpleMessageListenerContainer
From source file:org.calrissian.mango.jms.stream.utils.MessageQueueListener.java
public MessageQueueListener(AbstractJmsFileTransferSupport support, String destination, boolean isTopic) { this.support = support; //set up listener messageListenerContainer = new SimpleMessageListenerContainer(); messageListenerContainer.setConnectionFactory(support.getJmsTemplate().getConnectionFactory()); messageListenerContainer.setDestinationName(destination); messageListenerContainer.setMessageListener(this); messageListenerContainer.setPubSubDomain(isTopic); messageListenerContainer.start();//w w w . j a va 2s .c o m }
From source file:io.fabric8.quickstarts.activemq.App.java
@Bean SimpleMessageListenerContainer container(MessageListenerAdapter messageListener, ConnectionFactory connectionFactory) { SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(); container.setMessageListener(messageListener); container.setConnectionFactory(connectionFactory); container.setDestinationName(destination); return container; }
From source file:org.calrissian.mango.jms.stream.utils.MessageQueueListener.java
public MessageQueueListener(AbstractJmsFileTransferSupport support, Destination destination) { this.support = support; // this.destination = destination; //set up listener messageListenerContainer = new SimpleMessageListenerContainer(); messageListenerContainer.setConnectionFactory(support.getJmsTemplate().getConnectionFactory()); messageListenerContainer.setDestination(destination); messageListenerContainer.setMessageListener(this); messageListenerContainer.setPubSubDomain(destination instanceof Topic); messageListenerContainer.start();// w ww . j a va 2 s .c om }
From source file:org.apache.servicemix.jms.endpoints.JmsConsumerEndpoint.java
private AbstractMessageListenerContainer createSimpleMessageListenerContainer() { final SimpleMessageListenerContainer cont; if (isJms102()) { cont = new SimpleMessageListenerContainer102(); } else {// w ww. ja v a2 s . c o m cont = new SimpleMessageListenerContainer(); } cont.setConcurrentConsumers(concurrentConsumers); cont.setPubSubNoLocal(pubSubNoLocal); cont.setTaskExecutor(null); // TODO: value ? if (TRANSACTED_JMS.equals(transacted)) { cont.setSessionTransacted(true); } return cont; }
From source file:org.apache.camel.component.jms.JmsConfiguration.java
public AbstractMessageListenerContainer chooseMessageListenerContainerImplementation() { switch (consumerType) { case Simple:/*from www. j a v a 2 s .c o m*/ return new SimpleMessageListenerContainer(); case Default: return new DefaultMessageListenerContainer(); default: throw new IllegalArgumentException("Unknown consumer type: " + consumerType); } }
From source file:org.openengsb.ports.jms.JMSPortTest.java
@Before public void setup() { System.setProperty("org.apache.activemq.default.directory.prefix", tempFolder.getRoot().getAbsolutePath() + "/"); setupKeys();/*from w ww .j a va 2 s.com*/ String num = UUID.randomUUID().toString(); ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("vm://localhost" + num); jmsTemplate = new JmsTemplate(connectionFactory); jmsTemplateFactory = new JMSTemplateFactory() { @Override public SimpleMessageListenerContainer createMessageListenerContainer() { return simpleMessageListenerConainer; } @Override public JmsTemplate createJMSTemplate(DestinationUrl destinationUrl) { return jmsTemplate; } }; simpleMessageListenerConainer = new SimpleMessageListenerContainer(); incomingPort = new JMSIncomingPort(); incomingPort.setFactory(jmsTemplateFactory); incomingPort.setConnectionFactory(connectionFactory); RequestHandlerImpl requestHandlerImpl = new RequestHandlerImpl(); requestHandlerImpl.setUtilsService(new DefaultOsgiUtilsService(bundleContext)); handler = requestHandlerImpl; TestInterface mock2 = mock(TestInterface.class); registerServiceViaId(mock2, "test", TestInterface.class); when(mock2.method(anyString(), anyInt(), any(TestClass.class))).thenReturn(new TestClass("test")); Map<String, String> metaData = Maps.newHashMap(ImmutableMap.of("serviceId", "test")); MethodCall methodCall = new MethodCall("method", new Object[] { "123", 5, new TestClass("test"), }, metaData); call = new MethodCallMessage(methodCall, "123"); call.setDestination("host?receive"); MethodResult result = new MethodResult(new TestClass("test")); result.setMetaData(metaData); methodReturn = new MethodResultMessage(result, "123"); Dictionary<String, Object> props = new Hashtable<String, Object>(); props.put(Constants.PROVIDED_CLASSES_KEY, Password.class.getName()); props.put(Constants.DELEGATION_CONTEXT_KEY, org.openengsb.core.api.Constants.DELEGATION_CONTEXT_CREDENTIALS); registerService(new ClassProviderImpl(bundle, Sets.newHashSet(Password.class.getName())), props, ClassProvider.class); DefaultSecurityManager securityManager = new DefaultSecurityManager(); securityManager.setAuthenticator(new Authenticator() { @Override public AuthenticationInfo authenticate(AuthenticationToken authenticationToken) throws org.apache.shiro.authc.AuthenticationException { return new SimpleAuthenticationInfo(authenticationToken.getPrincipal(), authenticationToken.getCredentials(), "openengsb"); } }); SecurityUtils.setSecurityManager(securityManager); }