org.springframework.jms.config.JmsListenerEndpointRegistrar Java Examples

The following examples show how to use org.springframework.jms.config.JmsListenerEndpointRegistrar. 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: JmsMessageBrokerConfiguration.java    From piper with Apache License 2.0 6 votes vote down vote up
@Override
public void configureJmsListeners (JmsListenerEndpointRegistrar aRegistrar) {
  CoordinatorProperties coordinatorProperties = properties.getCoordinator();
  WorkerProperties workerProperties = properties.getWorker();
  if(coordinatorProperties.isEnabled()) {
    registerListenerEndpoint(aRegistrar, Queues.COMPLETIONS, coordinatorProperties.getSubscriptions().getCompletions() , coordinator, "complete");
    registerListenerEndpoint(aRegistrar, Queues.ERRORS, coordinatorProperties.getSubscriptions().getErrors(), coordinator, "handleError");
    registerListenerEndpoint(aRegistrar, Queues.EVENTS, coordinatorProperties.getSubscriptions().getEvents(), eventListener, "onApplicationEvent");
    registerListenerEndpoint(aRegistrar, Queues.JOBS, coordinatorProperties.getSubscriptions().getJobs(), coordinator, "start");
    registerListenerEndpoint(aRegistrar, Queues.SUBFLOWS, coordinatorProperties.getSubscriptions().getJobs(), coordinator, "create");
  }
  if(workerProperties.isEnabled()) {
    Map<String, Object> subscriptions = workerProperties.getSubscriptions();
    subscriptions.forEach((k,v) -> registerListenerEndpoint(aRegistrar, k, Integer.valueOf((String)v), worker, "handle"));
    registerListenerEndpoint(aRegistrar, Exchanges.CONTROL+"/"+Exchanges.CONTROL, 1, worker, "handle");
  }
}
 
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: 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 #4
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 #5
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);
}
 
Example #6
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 #7
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 #8
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 #9
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 #10
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 #11
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 #12
Source File: EnableJmsTests.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Override
public void configureJmsListeners(JmsListenerEndpointRegistrar registrar) {
	registrar.setContainerFactory(simpleFactory());
}
 
Example #13
Source File: EnableJmsTests.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Override
public void configureJmsListeners(JmsListenerEndpointRegistrar registrar) {
	registrar.setMessageHandlerMethodFactory(customMessageHandlerMethodFactory());
}
 
Example #14
Source File: EnableJmsTests.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Override
public void configureJmsListeners(JmsListenerEndpointRegistrar registrar) {
	registrar.setContainerFactory(simpleFactory());
}
 
Example #15
Source File: EnableJmsTests.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Override
public void configureJmsListeners(JmsListenerEndpointRegistrar registrar) {
	registrar.setContainerFactory(simpleFactory());
}
 
Example #16
Source File: EnableJmsTests.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Override
public void configureJmsListeners(JmsListenerEndpointRegistrar registrar) {
	registrar.setMessageHandlerMethodFactory(customMessageHandlerMethodFactory());
}
 
Example #17
Source File: EnableJmsTests.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Override
public void configureJmsListeners(JmsListenerEndpointRegistrar registrar) {
	registrar.setContainerFactory(simpleFactory());
}
 
Example #18
Source File: EnableJmsTests.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Override
public void configureJmsListeners(JmsListenerEndpointRegistrar registrar) {
	registrar.setMessageHandlerMethodFactory(customMessageHandlerMethodFactory());
}
 
Example #19
Source File: EnableJmsTests.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Override
public void configureJmsListeners(JmsListenerEndpointRegistrar registrar) {
	registrar.setContainerFactory(simpleFactory());
}
 
Example #20
Source File: JmsListenerConfigurer.java    From spring-analysis-note with MIT License 2 votes vote down vote up
/**
 * Callback allowing a {@link org.springframework.jms.config.JmsListenerEndpointRegistry
 * JmsListenerEndpointRegistry} and specific {@link org.springframework.jms.config.JmsListenerEndpoint
 * JmsListenerEndpoint} instances to be registered against the given
 * {@link JmsListenerEndpointRegistrar}. The default
 * {@link org.springframework.jms.config.JmsListenerContainerFactory JmsListenerContainerFactory}
 * can also be customized.
 * @param registrar the registrar to be configured
 */
void configureJmsListeners(JmsListenerEndpointRegistrar registrar);
 
Example #21
Source File: JmsListenerConfigurer.java    From java-technology-stack with MIT License 2 votes vote down vote up
/**
 * Callback allowing a {@link org.springframework.jms.config.JmsListenerEndpointRegistry
 * JmsListenerEndpointRegistry} and specific {@link org.springframework.jms.config.JmsListenerEndpoint
 * JmsListenerEndpoint} instances to be registered against the given
 * {@link JmsListenerEndpointRegistrar}. The default
 * {@link org.springframework.jms.config.JmsListenerContainerFactory JmsListenerContainerFactory}
 * can also be customized.
 * @param registrar the registrar to be configured
 */
void configureJmsListeners(JmsListenerEndpointRegistrar registrar);
 
Example #22
Source File: JmsListenerConfigurer.java    From spring4-understanding with Apache License 2.0 2 votes vote down vote up
/**
 * Callback allowing a {@link org.springframework.jms.config.JmsListenerEndpointRegistry
 * JmsListenerEndpointRegistry} and specific {@link org.springframework.jms.config.JmsListenerEndpoint
 * JmsListenerEndpoint} instances to be registered against the given
 * {@link JmsListenerEndpointRegistrar}. The default
 * {@link org.springframework.jms.config.JmsListenerContainerFactory JmsListenerContainerFactory}
 * can also be customized.
 * @param registrar the registrar to be configured
 */
void configureJmsListeners(JmsListenerEndpointRegistrar registrar);