Class AbstractRabbitMQProducer

  • All Implemented Interfaces:
    io.gridgo.connector.Producer, RabbitMQChannelLifeCycle, RabbitMQProducer, io.gridgo.connector.support.ProducerCapability, io.gridgo.framework.ComponentLifecycle, io.gridgo.utils.helper.Loggable, io.gridgo.utils.helper.Startable
    Direct Known Subclasses:
    DefaultRabbitMQProducer

    public abstract class AbstractRabbitMQProducer
    extends io.gridgo.connector.impl.AbstractProducer
    implements RabbitMQProducer
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected AbstractRabbitMQProducer​(io.gridgo.connector.support.config.ConnectorContext context, com.rabbitmq.client.Connection connection, RabbitMQQueueConfig queueConfig, java.lang.String uniqueIdentifier)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected byte[] buildRequestBody​(io.gridgo.framework.support.Payload payload)  
      org.joo.promise4j.Promise<io.gridgo.framework.support.Message,​java.lang.Exception> call​(io.gridgo.framework.support.Message request)  
      protected com.rabbitmq.client.AMQP.BasicProperties createBasicProperties​(java.lang.String correlationId)  
      protected org.joo.promise4j.Deferred<io.gridgo.framework.support.Message,​java.lang.Exception> createDeferred()  
      protected java.lang.String generateName()  
      com.rabbitmq.client.Channel getChannel()  
      RabbitMQQueueConfig getQueueConfig()  
      java.lang.String getResponseQueue()  
      protected java.lang.String getUniqueIdentifier()  
      boolean isCallSupported()  
      protected void onStart()  
      protected void onStop()  
      void send​(io.gridgo.framework.support.Message request)  
      org.joo.promise4j.Promise<io.gridgo.framework.support.Message,​java.lang.Exception> sendWithAck​(io.gridgo.framework.support.Message message)  
      • Methods inherited from class io.gridgo.connector.impl.AbstractProducer

        ack, ack, ack, ack, createMessage, getContext
      • Methods inherited from class io.gridgo.framework.AbstractComponentLifecycle

        getName, isStarted, start, stop, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface io.gridgo.framework.ComponentLifecycle

        getName, start, stop
      • Methods inherited from interface io.gridgo.utils.helper.Loggable

        getLogger, getLogger
      • Methods inherited from interface io.gridgo.connector.support.ProducerCapability

        isSendSupported, isSendWithAckSupported
    • Constructor Detail

      • AbstractRabbitMQProducer

        protected AbstractRabbitMQProducer​(@NonNull
                                           io.gridgo.connector.support.config.ConnectorContext context,
                                           @NonNull
                                           com.rabbitmq.client.Connection connection,
                                           @NonNull
                                           RabbitMQQueueConfig queueConfig,
                                           @NonNull
                                           java.lang.String uniqueIdentifier)
    • Method Detail

      • buildRequestBody

        protected byte[] buildRequestBody​(io.gridgo.framework.support.Payload payload)
      • call

        public final org.joo.promise4j.Promise<io.gridgo.framework.support.Message,​java.lang.Exception> call​(io.gridgo.framework.support.Message request)
        Specified by:
        call in interface io.gridgo.connector.Producer
      • createBasicProperties

        protected com.rabbitmq.client.AMQP.BasicProperties createBasicProperties​(java.lang.String correlationId)
      • createDeferred

        protected org.joo.promise4j.Deferred<io.gridgo.framework.support.Message,​java.lang.Exception> createDeferred()
      • generateName

        protected java.lang.String generateName()
        Specified by:
        generateName in class io.gridgo.framework.AbstractComponentLifecycle
      • isCallSupported

        public boolean isCallSupported()
        Specified by:
        isCallSupported in interface io.gridgo.connector.support.ProducerCapability
      • onStart

        protected void onStart()
        Specified by:
        onStart in class io.gridgo.framework.AbstractComponentLifecycle
      • onStop

        protected void onStop()
        Specified by:
        onStop in class io.gridgo.framework.AbstractComponentLifecycle
      • send

        public final void send​(@NonNull
                               io.gridgo.framework.support.Message request)
        Specified by:
        send in interface io.gridgo.connector.Producer
      • sendWithAck

        public final org.joo.promise4j.Promise<io.gridgo.framework.support.Message,​java.lang.Exception> sendWithAck​(@NonNull
                                                                                                                          io.gridgo.framework.support.Message message)
        Specified by:
        sendWithAck in interface io.gridgo.connector.Producer
      • getResponseQueue

        public java.lang.String getResponseQueue()
      • getUniqueIdentifier

        protected java.lang.String getUniqueIdentifier()