Advertisement
Guest User

Untitled

a guest
Apr 4th, 2020
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.01 KB | None | 0 0
  1. package com.ms1.model;
  2.  
  3. /**
  4.  * Message object which contains information about topic which this message belongs to
  5.  * and payload (data) of the message sent from any microservice. Payload is declared as Object,
  6.  * as the most generic way to represent the data
  7.  * @author Gordan Pendic
  8.  *
  9.  */
  10. public class Message { 
  11.     /**
  12.      * Data for representing the topic for the specific message
  13.      */
  14.     private String topic;
  15.    
  16.     /**
  17.      * Data which is contained in the message sent from any microservice
  18.      */
  19.     private Object payload;
  20.    
  21.     public Message(){} 
  22.    
  23.     public Message(String topic, Object payload) {
  24.         this.topic = topic;
  25.         this.payload = payload;
  26.     }
  27.    
  28.     public String getTopic() {
  29.         return topic;
  30.     }
  31.    
  32.     public void setTopic(String topic) {
  33.         this.topic = topic;
  34.     }
  35.    
  36.     public Object getPayload() {
  37.         return payload;
  38.     }
  39.    
  40.     public void setPayload(Object payload) {
  41.         this.payload = payload;
  42.     }
  43.  
  44.     @Override
  45.     public String toString() {
  46.         return "Message [topic=" + topic + ", payload=" + payload + "]";
  47.     }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement