Class GenericGateway
- All Implemented Interfaces:
Gateway
You can derive from this class, and it will take care of the basic mechanics of implementing a gateway. Your class must implement at least the following gateway operations: startGateway(), stopGateway(), and outgoingMessage().
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturn the ID that uniquely defines the gateway instance.protected GatewayServicesProvide access to the ColdFusion GatewayServices object.Override this function if you want to provide a helper class for your gateway.protected String[]Return the listeners for this gateway.intReturn the status of the gateway.voidrestart()Restart this gateway.protected booleansendMessage(CFEvent msg) Send an event to the ColdFusion event gateway service.voidsetCFCListeners(String[] listeners) Set the CFClisteners list.voidsetGatewayID(String id) Set the ID that uniquely defines the gateway instance.voidstart()Start the gateway.protected abstract voidGateway startup method.voidstop()Stop the gateway.protected abstract voidGateway shutdown method.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface coldfusion.eventgateway.Gateway
outgoingMessage
-
Field Details
-
status
protected int status -
listeners
-
-
Constructor Details
-
GenericGateway
Constructor.If your gateway defines its own constructor (to process a configuration file, for example), include a call to this constructor in your gateway constructor:
super(gatewayID).- Parameters:
gatewayID- The gateway ID string, provided by the ColdFusion MX Administrator.
-
-
Method Details
-
getGatewayID
Return the ID that uniquely defines the gateway instance.This function does not typically need to be overridden.
- Specified by:
getGatewayIDin interfaceGateway- Returns:
- The gateway ID set by setGatewayID()
-
setGatewayID
Set the ID that uniquely defines the gateway instance.This function does not typically need to be overridden.
- Specified by:
setGatewayIDin interfaceGateway- Parameters:
id- Gateway ID string- See Also:
-
setCFCListeners
Set the CFClisteners list.This function does not typically need to be overridden.
- Specified by:
setCFCListenersin interfaceGateway- Parameters:
listeners- A list of file system paths to ColdFusion components that listen for event messages from this gateway.- See Also:
-
getHelper
Override this function if you want to provide a helper class for your gateway.Return a CFC 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).
-
getStatus
public int getStatus()Return the status of the gateway.This function might need to be overridden if the resource can change status asynchronously from the gateway.
-
start
public void start()Start the gateway.This implementation handles the mantenance of the gateway status only. It calls
which is where you should implement your gateway-specific starting code.startGatewayAny exceptions thrown from
startGateway()will be logged in the eventgateway.log file. -
stop
public void stop()Stop the gateway.This implementation handles the maintenance of the gateway status. It calls
, which is where you should implement your gateway-specific code.stopGatewayThe method logs any exceptions thrown by
stopGateway()in the eventgateway.log file. -
restart
public void restart()Restart this gateway.Implemented as a call to stop() and then start().
You might override this to optimize processing, depending on the service the gateway communicates with.
-
startGateway
Gateway startup method.You must implement this method with the startup code for your gateway.
-
stopGateway
Gateway shutdown method.You must implement this method with the shutdown code for your gateway.
-
sendMessage
Send an event to the ColdFusion event gateway service. This is a utility method for convenience.- Parameters:
msg- The event structure to pass to ColdFusion.- Returns:
- true if the event was successfully placed on the queue.
-
getGatewayServices
Provide access to the ColdFusion GatewayServices object.- Returns:
- the GatewayServices object.
-
getListeners
Return the listeners for this gateway.- Returns:
- An array of paths for the gateway's listener CFCs.
-