Class CrudMessageListenerAndDelegationService

java.lang.Object
org.autumnframework.service.rabbit.client.listener.CrudMessageListenerAndDelegationService

public class CrudMessageListenerAndDelegationService extends Object
  • Constructor Details

    • CrudMessageListenerAndDelegationService

      @Autowired public CrudMessageListenerAndDelegationService(com.fasterxml.jackson.databind.ObjectMapper objectMapper, List<CrudQueueListener<?,?>> crudQueueListeners, List<OnQueueCreateListener<?,?>> onCreateListeners, List<OnQueueUpdateListener<?,?>> onUpdateListeners, List<OnQueueDeleteListener<?,?>> onDeleteListeners)
      This service is autowired with a list of all the CrudQueueListeners in the spring context. It listens to all the crud messages and receives the generic AMPQ Message. When a message is received, it uses the header to retrieve the class type of the message, then matches this against the CrudQueueListener class types. If a match is found, objectMapper is used to create the instance of this class and the matched CrudQueueListener is invoked with the specific message. If no match is found, we just trace log and ignore it. To receive messages, all you have to do is implement CrudQueueListener for your specific class type. No queue configuration or whatsoever required! You can register more than one CrudQueueListener You can now also register: - OnQueueCreateListener - OnQueueCreateListener - OnQueueCreateListener If a message is received, it will be sent to all of the above mentioned queue listeners
      Parameters:
      objectMapper -
      crudQueueListeners -
  • Method Details