Interface Gateway

All Known Implementing Classes:
GenericGateway

public interface Gateway
Gateway interface to the ColdFusion event gateway system.

All gateways to external event systems (for exanoke, SMS, IM, JMS) must implement this interface.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Indicates that the gateway has failed.
    static final int
    Indicates that the gateway is running.
    static final int
    Indicates that the gateway is starting.
    static final int
    Indicates that the gateway has stopped.
    static final int
    Indicates that the gateway is stopping.
  • Method Summary

    Modifier and Type
    Method
    Description
    Return the ID that uniquely defines the gateway instance.
    Return a gateway helper class (if any) so that a CFC can invoke gateway-specific utility functions that might be useful to the CFML developer.
    int
    Return the status of the gateway.
    Send a message from the gateway to the resource.
    void
    Restart this gateway.
    void
    setCFCListeners(String[] listeners)
    Set the CFClisteners list.
    void
    Set the ID that uniquely defines the gateway instance.
    void
    Start this gateway.
    void
    Stop this gateway.
  • Field Details

  • Method Details

    • setGatewayID

      void setGatewayID(String id)
      Set the ID that uniquely defines the gateway instance.

      Generally, you just need to return this string in getGatewayID(). It is used by the event manager to identify the gateway.

      Parameters:
      id - The gateway id string.
      See Also:
    • getGatewayID

      String getGatewayID()
      Return the ID that uniquely defines the gateway instance.
      Returns:
      The gateway ID set by setGatewayID().
    • outgoingMessage

      String outgoingMessage(CFEvent cfmsg)
      Send a message from the gateway to the resource.

      The message to send and related information is located in the Map returned by the CFEvent getData() method. The values in the Map are gateway-specific; the CFML sending the output message must put the information the gateway requires in the Map.

      Parameters:
      cfmsg - the CFEvent object containing the message to send
      Returns:
      A gateway-specific string, such as an outgoing message ID or status.
      See Also:
    • setCFCListeners

      void setCFCListeners(String[] listeners)
      Set the CFClisteners list.

      Takes an array of fully qualified ColdFusion component paths (for example, c:/path/to/my/template.cfc) each of which should each receive events from the gateway. This method resets the list each time it is called.

      This method is called by the Event Service manager on startup, and may be called if the configuration of the gateway is changed during operation.

      Parameters:
      listeners - An array of filesystem paths to ColdFusion components.
      See Also:
    • getHelper

      GatewayHelper getHelper()
      Return a gateway helper class (if any) so that a CFC can invoke gateway-specific utility functions that might be useful to the CFML developer. The helper class must implement the GatewayHelper marker interface.

      Called by the CFML function getGatewayHelper(gatewayID).

      Return null if you do not provide a helper class.

      Returns:
      An instance of the gateway-specific helper class, or null.
      See Also:
    • start

      void start()
      Start this gateway.

      Perform any required gateway-specific initialization. The method starts up any listener threads that monitor the event source for the gateway.

      This function should return within a time-out period that is specified in the ColdFusion MX Administrator. There is also an Administrator option that determines whether the thread that calls this function gets killed if the function does not return within the time-out period.

      See Also:
    • stop

      void stop()
      Stop this gateway.

      Perform any gateway-specific shutdown tasks, such as shutting down listener threads or releasing resources.

      See Also:
    • restart

      void restart()
      Restart this gateway.

      Generally, this method can be implemented as a call to stop() and then start(), but you may be able to optimize this method, depending on the service tht the gateway communicates with.

      See Also:
    • getStatus

      int getStatus()
      Return the status of the gateway.
      Returns:
      One of STARTING, RUNNING, STOPPING, STOPPED, FAILED.