Class Topic


  • public class Topic
    extends Object

    Provides an Topic class.

    The example below illustrates the Event API.

    
      import io.nitric.api.Event;
      import io.nitric.api.Events;
    
      // Create an order completed event
      var payload = Map.of("id", id, "status", "completed");
      var event = Event.build(payload);
    
      // Publish the event to the orders topic
      Events.topic("orders").publish(event);
     
    See Also:
    Events
    • Method Detail

      • getName

        public String getName()
        Return the topic name.
        Returns:
        the topic name
      • publish

        public void publish​(Event event)
        Publish the given event to this topic.
        Parameters:
        event - the even to publish (required)
      • toString

        public String toString()
        Return the string representation of this object.
        Overrides:
        toString in class Object
        Returns:
        the string representation of this object