Java Code Examples for org.springframework.jms.config.SimpleJmsListenerEndpoint#setDestination()

The following examples show how to use org.springframework.jms.config.SimpleJmsListenerEndpoint#setDestination() . 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: JMSConfiguration.java    From galeb with Apache License 2.0 6 votes vote down vote up
@Override
public void configureJmsListeners(JmsListenerEndpointRegistrar endpointRegistrar) {
    SimpleJmsListenerEndpoint endpoint = new SimpleJmsListenerEndpoint();
    endpoint.setId(QUEUE_NAME);
    endpoint.setDestination(QUEUE_NAME);
    endpoint.setConcurrency("5-5");
    endpoint.setMessageListener(message -> {
        try {
            if (message.isBodyAssignableTo(TargetDTO.class)) {
                healthCheckerService.check(message.getBody(TargetDTO.class));
            }
        } catch (JMSException e) {
            JsonEventToLogger eventToLogger = new JsonEventToLogger(this.getClass());
            eventToLogger.put("short_message", "Error processing message from queue");
            eventToLogger.sendError(e);
        }
    });
    endpointRegistrar.registerEndpoint(endpoint);
}
 
Example 2
Source File: EventListenerConfigurer.java    From blackduck-alert with Apache License 2.0 6 votes vote down vote up
@Override
public void configureJmsListeners(final JmsListenerEndpointRegistrar registrar) {
    logger.info("Registering JMS Listeners");
    for (final AlertEventListener listener : alertEventListeners) {
        if (listener != null) {
            final String destinationName = listener.getDestinationName();
            final String listenerId = createListenerId(destinationName);
            logger.info("Registering JMS Listener: {}", listenerId);
            final SimpleJmsListenerEndpoint endpoint = new SimpleJmsListenerEndpoint();
            endpoint.setId(listenerId);
            endpoint.setDestination(destinationName);
            endpoint.setMessageListener(listener);
            registrar.registerEndpoint(endpoint);
        }
    }
}
 
Example 3
Source File: EnableJmsTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Override
public void configureJmsListeners(JmsListenerEndpointRegistrar registrar) {
	registrar.setEndpointRegistry(customRegistry());

	// Also register a custom endpoint
	SimpleJmsListenerEndpoint endpoint = new SimpleJmsListenerEndpoint();
	endpoint.setId("myCustomEndpointId");
	endpoint.setDestination("myQueue");
	endpoint.setMessageListener(simpleMessageListener());
	registrar.registerEndpoint(endpoint);
}
 
Example 4
Source File: AnnotationDrivenNamespaceTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Override
public void configureJmsListeners(JmsListenerEndpointRegistrar registrar) {
	SimpleJmsListenerEndpoint endpoint = new SimpleJmsListenerEndpoint();
	endpoint.setId("myCustomEndpointId");
	endpoint.setDestination("myQueue");
	endpoint.setMessageListener(messageListener);
	registrar.registerEndpoint(endpoint);
}
 
Example 5
Source File: EnableJmsTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Override
public void configureJmsListeners(JmsListenerEndpointRegistrar registrar) {
	registrar.setEndpointRegistry(customRegistry());

	// Also register a custom endpoint
	SimpleJmsListenerEndpoint endpoint = new SimpleJmsListenerEndpoint();
	endpoint.setId("myCustomEndpointId");
	endpoint.setDestination("myQueue");
	endpoint.setMessageListener(simpleMessageListener());
	registrar.registerEndpoint(endpoint);
}
 
Example 6
Source File: AnnotationDrivenNamespaceTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Override
public void configureJmsListeners(JmsListenerEndpointRegistrar registrar) {
	SimpleJmsListenerEndpoint endpoint = new SimpleJmsListenerEndpoint();
	endpoint.setId("myCustomEndpointId");
	endpoint.setDestination("myQueue");
	endpoint.setMessageListener(messageListener);
	registrar.registerEndpoint(endpoint);
}
 
Example 7
Source File: ReceiverConfig.java    From spring-jms with MIT License 5 votes vote down vote up
@Bean
public DefaultMessageListenerContainer orderMessageListenerContainer() {
  SimpleJmsListenerEndpoint endpoint =
      new SimpleJmsListenerEndpoint();
  endpoint.setMessageListener(new StatusMessageListener("DMLC"));
  endpoint.setDestination(status1Destination);

  return orderDefaultJmsListenerContainerFactory()
      .createListenerContainer(endpoint);
}
 
Example 8
Source File: ReceiverConfig.java    From spring-jms with MIT License 5 votes vote down vote up
@Bean
public SimpleMessageListenerContainer statusMessageListenerContainer() {
  SimpleJmsListenerEndpoint endpoint =
      new SimpleJmsListenerEndpoint();
  endpoint.setMessageListener(new StatusMessageListener("SMLC"));
  endpoint.setDestination(status2Destination);

  return orderSimpleJmsListenerContainerFactory()
      .createListenerContainer(endpoint);
}
 
Example 9
Source File: EnableJmsTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Override
public void configureJmsListeners(JmsListenerEndpointRegistrar registrar) {
	registrar.setEndpointRegistry(customRegistry());

	// Also register a custom endpoint
	SimpleJmsListenerEndpoint endpoint = new SimpleJmsListenerEndpoint();
	endpoint.setId("myCustomEndpointId");
	endpoint.setDestination("myQueue");
	endpoint.setMessageListener(simpleMessageListener());
	registrar.registerEndpoint(endpoint);
}
 
Example 10
Source File: AnnotationDrivenNamespaceTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Override
public void configureJmsListeners(JmsListenerEndpointRegistrar registrar) {
	SimpleJmsListenerEndpoint endpoint = new SimpleJmsListenerEndpoint();
	endpoint.setId("myCustomEndpointId");
	endpoint.setDestination("myQueue");
	endpoint.setMessageListener(messageListener);
	registrar.registerEndpoint(endpoint);
}
 
Example 11
Source File: JmsMessageBrokerConfiguration.java    From piper with Apache License 2.0 5 votes vote down vote up
private void registerListenerEndpoint(JmsListenerEndpointRegistrar aRegistrar, String aQueueName, int aConcurrency, Object aDelegate, String aMethodName) {
  logger.info("Registring JMS Listener: {} -> {}:{}", aQueueName, aDelegate.getClass().getName(), aMethodName);
  
  MessageListenerAdapter messageListener = new NoReplyMessageListenerAdapter(aDelegate);
  messageListener.setMessageConverter(jacksonJmsMessageConverter(objectMapper));
  messageListener.setDefaultListenerMethod(aMethodName);

  SimpleJmsListenerEndpoint endpoint = new SimpleJmsListenerEndpoint();
  endpoint.setId(aQueueName+"Endpoint");
  endpoint.setDestination(aQueueName);
  endpoint.setMessageListener(messageListener);

  aRegistrar.registerEndpoint(endpoint,createContainerFactory(aConcurrency));
}
 
Example 12
Source File: JmsChannelModelProcessor.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
protected JmsListenerEndpoint createJmsListenerEndpoint(JmsInboundChannelModel jmsChannelModel, String tenantId, EventRegistry eventRegistry) {
    
    String endpointId = getEndpointId(jmsChannelModel, tenantId);

    SimpleJmsListenerEndpoint endpoint = new SimpleJmsListenerEndpoint();

    endpoint.setId(endpointId);
    endpoint.setDestination(resolve(jmsChannelModel.getDestination()));

    String selector = jmsChannelModel.getSelector();
    if (StringUtils.hasText(selector)) {
        endpoint.setSelector(resolve(selector));
    }

    String subscription = jmsChannelModel.getSubscription();
    if (StringUtils.hasText(subscription)) {
        endpoint.setSubscription(resolve(subscription));
    }

    String concurrency = jmsChannelModel.getConcurrency();
    if (StringUtils.hasText(concurrency)) {
        endpoint.setConcurrency(resolve(concurrency));
    }

    endpoint.setMessageListener(createMessageListener(eventRegistry, jmsChannelModel));
    return endpoint;
}
 
Example 13
Source File: JmsTracingConfigurationTest.java    From spring-cloud-sleuth with Apache License 2.0 5 votes vote down vote up
@Override
public void configureJmsListeners(JmsListenerEndpointRegistrar registrar) {
	SimpleJmsListenerEndpoint endpoint = new SimpleJmsListenerEndpoint();
	endpoint.setId("myCustomEndpointId");
	endpoint.setDestination("myQueue");
	endpoint.setMessageListener(simpleMessageListener(this.current));
	registrar.registerEndpoint(endpoint);
}