Class InMemoryPullPullPipe

java.lang.Object
org.red5.server.messaging.AbstractPipe
org.red5.server.messaging.InMemoryPullPullPipe
All Implemented Interfaces:
IMessageInput, IMessageOutput, IPipe

public class InMemoryPullPullPipe extends AbstractPipe
A simple in-memory version of pull-pull pipe. It is triggered by an active consumer that pulls messages through it from a pullable provider.
Author:
The Red5 Project, Steven Gong (steven.gong@gmail.com)
  • Field Details

    • log

      private static final org.slf4j.Logger log
  • Constructor Details

    • InMemoryPullPullPipe

      public InMemoryPullPullPipe()
  • Method Details

    • subscribe

      public boolean subscribe(IConsumer consumer, Map<String,Object> paramMap)
      Connect consumer to this pipe. Doesn't allow to connect one consumer twice. Does register event listeners if instance of IPipeConnectionListener is given.
      Specified by:
      subscribe in interface IMessageInput
      Overrides:
      subscribe in class AbstractPipe
      Parameters:
      consumer - Consumer
      paramMap - Parameters passed with connection, used in concrete pipe implementations
      Returns:
      true if consumer was added, false otherwise
    • subscribe

      public boolean subscribe(IProvider provider, Map<String,Object> paramMap)
      Connect provider to this pipe. Doesn't allow to connect one provider twice. Does register event listeners if instance of IPipeConnectionListener is given.
      Specified by:
      subscribe in interface IMessageOutput
      Overrides:
      subscribe in class AbstractPipe
      Parameters:
      provider - Provider
      paramMap - Parameters passed with connection, used in concrete pipe implementations
      Returns:
      true if provider was added, false otherwise
    • pullMessage

      public IMessage pullMessage() throws IOException
      Pull message from this input endpoint. Return w/o waiting.
      Returns:
      The pulled message or null if message is not available.
      Throws:
      IOException - on error
    • pullMessage

      public IMessage pullMessage(long wait)
      Pull message from this input endpoint. Wait wait milliseconds if message is not available.
      Parameters:
      wait - milliseconds to wait when message is not available.
      Returns:
      The pulled message or null if message is not available.
    • pushMessage

      public void pushMessage(IMessage message)
      Push a message to this output endpoint. May block the pusher when output can't handle the message at the time.
      Parameters:
      message - Message to be pushed.