Class HttpUpstreamGateway

  • All Implemented Interfaces:
    ca.uqac.lif.azrael.Printable, ca.uqac.lif.azrael.Readable, 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  HttpUpstreamGateway.PullCallback
      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 m_pullMethod
      The method (GET or POST) that will be used when listening to the pull URL
      protected java.lang.String m_pullUrl
      The URL that the server will listen to for pull requests
      protected ca.uqac.lif.jerrydog.RequestCallback.Method m_pushMethod
      The method (GET or POST) that will be used when calling the push URL
      protected java.lang.String m_pushUrl
      The URL that will be called when events are pushed to this gateway
      protected ca.uqac.lif.jerrydog.Server m_server
      The web server that will listen for downstream pull requests
      protected static int s_numRetries
      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_eventTracker, m_hasBeenNotifiedOfEndOfTrace, m_inputArity, m_inputCount, m_inputPullables, m_inputQueues, m_notifiedEndOfTraceDownstream, m_outputArity, m_outputCount, m_outputPushables, m_outputQueues, MAX_PULL_RETRIES, s_versionString
    • Constructor Summary

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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected boolean compute​(java.lang.Object[] inputs, java.util.Queue<java.lang.Object[]> outputs)  
      HttpUpstreamGateway duplicate​(boolean with_state)  
      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
      void start()  
      void stop()  
      • Methods inherited from class ca.uqac.lif.cep.tmf.Sink

        pull, pullHard
      • Methods inherited from class ca.uqac.lif.cep.SynchronousProcessor

        getPullableOutput, getPushableInput, setEventTracker
      • Methods inherited from class ca.uqac.lif.cep.Processor

        allNotifiedEndOfTrace, allNull, associateTo, associateToInput, associateToOutput, copyInputQueue, copyOutputQueue, duplicate, duplicateInto, equals, getAt, getContext, getContext, getEmptyQueue, getEventTracker, getId, getInputArity, getInputCount, getInputQueue, getInputType, getInputTypesFor, getLeaves, getLeaves, getOutputArity, getOutputCount, getOutputQueue, getOutputType, getPullableInput, getPullableOutput, getPushableInput, getPushableOutput, hashCode, leftShift, newContext, onEndOfTrace, or, or, print, printState, read, 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 Detail

      • m_pushUrl

        protected java.lang.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 java.lang.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:
        Constant Field Values
    • Constructor Detail

      • HttpUpstreamGateway

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

        public HttpUpstreamGateway​(java.lang.String push_url)
    • Method Detail

      • 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​(java.lang.Object[] inputs,
                                  java.util.Queue<java.lang.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