Class AppIntercom<T>

java.lang.Object
de.iip_ecosphere.platform.transport.AppIntercom<T>
Type Parameters:
T - the type of data to be exchanged

public class AppIntercom<T> extends Object
Simple app intercom facility. Declare the intercom as attribute and call #start() in service start and #stop() in service stop.
Author:
Holger Eichelberger, SSE
  • Field Details

  • Constructor Details

    • AppIntercom

      public AppIntercom(String channel, Consumer<T> consumer, Class<T> cls)
      Creates an intercom class.
      Parameters:
      channel - the transport channel to use
      consumer - the consumer when data is received
      cls - the class of data
    • AppIntercom

      public AppIntercom(Consumer<T> consumer, Class<T> cls)
      Creates an intercom class with default channel name.
      Parameters:
      consumer - the consumer when data is received
      cls - the class of data
  • Method Details

    • start

      public void start() throws ExecutionException
      Start the intercom.
      Throws:
      ExecutionException - if starting fails
    • stop

      public void stop()
      Stops the intercom.
    • asyncSend

      public void asyncSend(T data) throws IOException
      Sends data asynchronously.
      Parameters:
      data - the data
      Throws:
      IOException - if data cannot be sent
    • syncSend

      public void syncSend(T data) throws IOException
      Sends data synchronously.
      Parameters:
      data - the data
      Throws:
      IOException - if data cannot be sent