Class HttpUpstreamGateway

java.lang.Object
ca.uqac.lif.cep.Processor
ca.uqac.lif.cep.SynchronousProcessor
ca.uqac.lif.cep.tmf.Sink
ca.uqac.lif.cep.http.HttpUpstreamGateway
All Implemented Interfaces:
ca.uqac.lif.cep.Contextualizable, ca.uqac.lif.cep.Duplicable, ca.uqac.lif.cep.DuplicableProcessor

public class HttpUpstreamGateway extends ca.uqac.lif.cep.tmf.Sink
Sends character strings over the network through HTTP requests. Graphically, this processor is represented as:

Processor graph

Author:
Sylvain Hallé
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    protected class 
    Server callback that fires when the URL for this upstream gateway receives a request for events

    Nested classes/interfaces inherited from class ca.uqac.lif.cep.SynchronousProcessor

    ca.uqac.lif.cep.SynchronousProcessor.InputPushable, ca.uqac.lif.cep.SynchronousProcessor.OutputPullable

    Nested classes/interfaces inherited from class ca.uqac.lif.cep.Processor

    ca.uqac.lif.cep.Processor.InternalProcessorState
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected ca.uqac.lif.jerrydog.RequestCallback.Method
    The method (GET or POST) that will be used when listening to the pull URL
    protected String
    The URL that the server will listen to for pull requests
    protected ca.uqac.lif.jerrydog.RequestCallback.Method
    The method (GET or POST) that will be used when calling the push URL
    protected String
    The URL that will be called when events are pushed to this gateway
    protected ca.uqac.lif.jerrydog.Server
    The web server that will listen for downstream pull requests
    protected static final int
    The number of times the processor will retry when it fails to establish a connection to the other end

    Fields inherited from class ca.uqac.lif.cep.SynchronousProcessor

    m_inputPushables, m_outputPullables, m_tempQueue

    Fields inherited from class ca.uqac.lif.cep.Processor

    m_context, m_hasBeenNotifiedOfEndOfTrace, m_inputArity, m_inputPullables, m_inputQueues, m_notifiedEndOfTraceDownstream, m_outputArity, m_outputPushables, m_outputQueues, MAX_PULL_RETRIES, s_versionString
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    HttpUpstreamGateway(String push_url, ca.uqac.lif.jerrydog.RequestCallback.Method push_method, String pull_url, int pull_port)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected boolean
    compute(Object[] inputs, Queue<Object[]> outputs)
     
    duplicate(boolean with_state)
     
    setPullMethod(ca.uqac.lif.jerrydog.RequestCallback.Method m)
    Sets the method (GET or POST) the gateway will respond to when listening to pull requests from downstream
    void
     
    void
     

    Methods inherited from class ca.uqac.lif.cep.tmf.Sink

    pull, pullHard

    Methods inherited from class ca.uqac.lif.cep.SynchronousProcessor

    getPullableOutput, getPushableInput

    Methods inherited from class ca.uqac.lif.cep.Processor

    allNotifiedEndOfTrace, allNull, copyInputQueue, copyOutputQueue, duplicate, duplicateInto, equals, getAt, getContext, getContext, getEmptyQueue, getId, getInputArity, getInputQueue, getInputType, getInputTypesFor, getOutputArity, getOutputQueue, getOutputType, getPullableInput, getPullableOutput, getPushableInput, getPushableOutput, hashCode, leftShift, newContext, onEndOfTrace, or, or, or, printState, readState, reset, rightShift, setContext, setContext, setPullableInput, setPushableOutput, startAll, stopAll

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • m_pushUrl

      protected String m_pushUrl
      The URL that will be called when events are pushed to this gateway
    • m_pushMethod

      protected ca.uqac.lif.jerrydog.RequestCallback.Method m_pushMethod
      The method (GET or POST) that will be used when calling the push URL
    • m_server

      protected ca.uqac.lif.jerrydog.Server m_server
      The web server that will listen for downstream pull requests
    • m_pullUrl

      protected String m_pullUrl
      The URL that the server will listen to for pull requests
    • m_pullMethod

      protected ca.uqac.lif.jerrydog.RequestCallback.Method m_pullMethod
      The method (GET or POST) that will be used when listening to the pull URL
    • s_numRetries

      protected static final int s_numRetries
      The number of times the processor will retry when it fails to establish a connection to the other end
      See Also:
  • Constructor Details

    • HttpUpstreamGateway

      public HttpUpstreamGateway(String push_url, ca.uqac.lif.jerrydog.RequestCallback.Method push_method, String pull_url, int pull_port)
    • HttpUpstreamGateway

      public HttpUpstreamGateway(String push_url)
  • Method Details

    • setPullMethod

      public HttpUpstreamGateway setPullMethod(ca.uqac.lif.jerrydog.RequestCallback.Method m)
      Sets the method (GET or POST) the gateway will respond to when listening to pull requests from downstream
      Parameters:
      m - The method
      Returns:
      This gateway
    • compute

      protected boolean compute(Object[] inputs, Queue<Object[]> outputs) throws ca.uqac.lif.cep.ProcessorException
      Specified by:
      compute in class ca.uqac.lif.cep.SynchronousProcessor
      Throws:
      ca.uqac.lif.cep.ProcessorException
    • start

      public void start() throws ca.uqac.lif.cep.ProcessorException
      Overrides:
      start in class ca.uqac.lif.cep.Processor
      Throws:
      ca.uqac.lif.cep.ProcessorException
    • stop

      public void stop() throws ca.uqac.lif.cep.ProcessorException
      Overrides:
      stop in class ca.uqac.lif.cep.Processor
      Throws:
      ca.uqac.lif.cep.ProcessorException
    • duplicate

      public HttpUpstreamGateway duplicate(boolean with_state)
      Specified by:
      duplicate in interface ca.uqac.lif.cep.Duplicable
      Specified by:
      duplicate in class ca.uqac.lif.cep.Processor