Class TOTVSMessage<T>


  • public class TOTVSMessage<T>
    extends Object
    This class provides the message base model for use in communication between microservices within the context of the application / solution.
    Author:
    diego.n
    See Also:
    TOTVS - Modelo base de mensagem
    • Constructor Detail

      • TOTVSMessage

        public TOTVSMessage()
        The default constructor of this class.
      • TOTVSMessage

        public TOTVSMessage​(String type)
        Default constructor that initializes with defaults values ​​if not defined. Sets a new TOTVSHeader and current timestamp.
        Parameters:
        type - The types indicates the event or command contained in the message.
      • TOTVSMessage

        public TOTVSMessage​(String type,
                            Map<String,​String> customHeaders)
        Constructor with custom headers.
        Parameters:
        type - the types indicates the event or command contained in the message.
        customHeaders - a map with custom headers for this message.
      • TOTVSMessage

        public TOTVSMessage​(String type,
                            @Nullable
                            String tenantId)
        Default constructor that initializes with defaults values ​​if not defined. Sets a new TOTVSHeader and current timestamp.
        Parameters:
        type - The types indicates the event or command contained in the message.
        tenantId - tenant identification
      • TOTVSMessage

        public TOTVSMessage​(String type,
                            TransactionInfo transactionInfo)
        Constructor with TransactionInfo that initializes with defaults values ​​if not defined.
        Parameters:
        type - The types indicates the event or command contained in the message.
        transactionInfo - The transaction information of the current thread.
      • TOTVSMessage

        public TOTVSMessage​(String type,
                            @Nullable
                            String tenantId,
                            TransactionInfo transactionInfo)
        Constructor with TransactionInfo that initializes with defaults values ​​if not defined.
        Parameters:
        type - The types indicates the event or command contained in the message.
        tenantId - Tenant identification.
        transactionInfo - The transaction information of the current thread.
      • TOTVSMessage

        public TOTVSMessage​(String type,
                            TransactionInfo transactionInfo,
                            CloudEventsInfo cloudEventsInfo)
        Constructor with TransactionInfo that initializes with defaults values ​​if not defined.
        Parameters:
        type - The types indicates the event or command contained in the message.
        transactionInfo - The transaction information of the current thread.
        cloudEventsInfo - The cloudevents information of the current thread.
      • TOTVSMessage

        public TOTVSMessage​(String type,
                            @Nullable
                            String tenantId,
                            TransactionInfo transactionInfo,
                            CloudEventsInfo cloudEventsInfo)
        Constructor with TransactionInfo that initializes with defaults values ​​if not defined.
        Parameters:
        type - The types indicates the event or command contained in the message.
        tenantId - Tenant identification.
        transactionInfo - The transaction information of the current thread.
        cloudEventsInfo - The cloudevents information of the current thread.
      • TOTVSMessage

        public TOTVSMessage​(String type,
                            T content)
        Constructor with content that initializes with defaults values ​​if not defined.
        Parameters:
        type - The types indicates the event or command contained in the message.
        content - Content message (body).
      • TOTVSMessage

        public TOTVSMessage​(String type,
                            T content,
                            Map<String,​String> headers)
        Constructor with content that initializes with defaults values ​​if not defined.
        Parameters:
        type - The types indicates the event or command contained in the message.
        content - Content message (body).
        headers - a map with custom headers for this message.
      • TOTVSMessage

        public TOTVSMessage​(String type,
                            @Nullable
                            String tenantId,
                            T content)
        Constructor with content that initializes with defaults values ​​if not defined.
        Parameters:
        type - The types indicates the event or command contained in the message.
        tenantId - Tenant identification
        content - Content message (body).
      • TOTVSMessage

        public TOTVSMessage​(String type,
                            T content,
                            TransactionInfo transactionInfo)
        Constructor with content that initializes with defaults values ​​if not defined.
        Parameters:
        type - The types indicates the event or command contained in the message.
        content - Content message (body).
        transactionInfo - The transaction information of the current thread.
      • TOTVSMessage

        public TOTVSMessage​(String type,
                            @Nullable
                            String tenantId,
                            T content,
                            TransactionInfo transactionInfo)
        Constructor with content that initializes with defaults values ​​if not defined.
        Parameters:
        type - The types indicates the event or command contained in the message.
        tenantId - Tenant identification.
        content - Content message (body).
        transactionInfo - The transaction information of the current thread.
      • TOTVSMessage

        public TOTVSMessage​(String type,
                            T content,
                            TransactionInfo transactionInfo,
                            CloudEventsInfo cloudEventsInfo)
        Constructor with content that initializes with defaults values ​​if not defined.
        Parameters:
        type - The types indicates the event or command contained in the message.
        content - Content message (body).
        transactionInfo - The transaction information of the current thread.
        cloudEventsInfo - The cloudevents information of the current thread.
    • Method Detail

      • getHeader

        public TOTVSHeader getHeader()
        This method returns the header message.
        Returns:
        header header message.
      • setHeader

        public void setHeader​(TOTVSHeader header)
        This method sets the header message.
        Parameters:
        header - content header message
      • getContent

        public T getContent()
        This method returns the content message (body).
        Returns:
        content content message.
      • setContent

        public void setContent​(T content)
        This method sets the content message.
        Parameters:
        content - content message (body)
      • sendTo

        public void sendTo​(org.springframework.messaging.MessageChannel channel)
        This method builds a message with this process message and send to a specified channel with a "type" header.
        Parameters:
        channel - channel