Class EngineClientBean
- java.lang.Object
-
- com.apama.engine.beans.EngineClientBean
-
- All Implemented Interfaces:
ConnectOperationsInterface,DeleteOperationsInterface,EngineClientInterface,InjectOperationsInterface,InspectOperationsInterface,ReceiveConsumerOperationsInterface,SendOperationsInterface,WatchOperationsInterface,BaseClientInterface,PingClientInterface,PingOperationsInterface,java.lang.AutoCloseable
public class EngineClientBean extends java.lang.Object implements EngineClientInterface
EngineClientBean is a JavaBean for interacting with an Apama engine, typically a Correlator. This includes the ability to send and receive events, inject and delete EPL/MonitorScript, connect Apama engines together, inspect what was injected into correlator and more.Receiving events using the engine client
Clients wishing to use the engine client to receive events should do so by adding one or more named consumers, each of which has its own independent event listener and list of channels to receive from. The named consumer methods generally have "consumer" in their name, and are defined by
ReceiveConsumerOperationsInterface.Users needing more advanced send/receive functionality should also consider using the higher level
IEventServicerather than the engine client.Use
EventTypeand its associated classes to parse and generateEventobjects for receiving and sending using this class.Lifecycle of the engine client
Once this engine client has been configured as needed (e.g.
setPort(int),setHost(String)), a connection can be established either synchronously usingconnectNow()(which throws an exception on error) or asynchronously usingconnectInBackground()(which automatically retries until a connection is established - seesetConnectionPollingInterval(int)andsetReconnectPeriod(long)).Once the bean connected successfully, a background thread will keep pinging it to ensure the connection is still up (see
setConnectionPollingInterval(int)). If the entire bean connection is lost, theBaseClientInterface.PROPERTY_BEAN_CONNECTEDandReceiveConsumerOperationsInterface.PROPERTY_ALL_CONSUMERS_CONNECTEDproperties will change to false to notify the user of the engine client, and the client will continue to try to reconnect in the background (with the retry interval configurable usingsetConnectionPollingInterval(int)). If the client itself remains connected but its named consumers are disconnected by the engine (due to being slow, if slow consumer disconnection is enabled) then it is the caller's responsibility to force reconnection of the consumers by disconnecting and reconnecting the client (although applications with this requirement may be better off using theIEventServiceinstead). To prevent reconnecting slow consumers too soon after disconnection, a minimum time between reconnection attempts can be configured usingsetReconnectPeriod(long).The engine client can be disconnected using
disconnect()whenever required, however once it is no longer needed any more, final cleanup should be performed by callingclose()which will disconnect it and also ensure that any background threads started by the client have been terminated.Thread-safety
This class has locking so that concurrent use by multiple threads is safe. To avoid deadlock problems, clients should not call methods on the object within synchronous event listeners - instead if this is required, the consumer should be added as asynchronous (see addConsumer method), or the EventService should be used instead. However it is safe to call engine client methods (except dispose) from within property change listeners (which are asynchronous by default from 5.2 onwards).
Note that the deprecated "simple bean receiver" (and ReceiveOperationsInterface) feature was removed in the 5.1 release; the named consumer interface should now be used instead.
-
-
Field Summary
-
Fields inherited from interface com.apama.net.beans.interfaces.BaseClientInterface
COPYRIGHT, DEFAULT_CONNECTION_POLLING_INTERVAL, DEFAULT_HOST, DEFAULT_PORT, DEFAULT_PROCESS_NAME, PRODUCTNAME, PROPERTY_BEAN_CONNECTED, PROPERTY_CONNECTION_POLLING_INTERVAL, PROPERTY_HOST, PROPERTY_PORT, PROPERTY_PROCESS_NAME, PROPERTY_VERBOSE, VERSION
-
Fields inherited from interface com.apama.engine.beans.interfaces.EngineClientInterface
DEFAULT_MONITOR_ONLY, DEFAULT_RECEIVE_ONLY, PROPERTY_MONITOR_ONLY, PROPERTY_RECEIVE_ONLY
-
Fields inherited from interface com.apama.engine.beans.interfaces.InspectOperationsInterface
DEFAULT_INSPECT_POLLING_INTERVAL, PROPERTY_ENGINE_INFO, PROPERTY_INSPECT_POLLING_INTERVAL
-
Fields inherited from interface com.apama.engine.beans.interfaces.ReceiveConsumerOperationsInterface
PROPERTY_ALL_CONSUMERS_CONNECTED
-
Fields inherited from interface com.apama.engine.beans.interfaces.WatchOperationsInterface
DEFAULT_STATUS_POLLING_INTERVAL, PROPERTY_STATUS, PROPERTY_STATUS_POLLING_INTERVAL
-
-
Constructor Summary
Constructors Constructor Description EngineClientBean()Default constructor - as required to be a bean.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description ConsumerOperationsInterfaceaddAsyncConsumer(java.lang.String uniqueName, java.lang.String... channels)Add a new uniquely-named asynchronous consumer that listens on a specified set of channels.ConsumerOperationsInterfaceaddConsumer(java.lang.String uniqueName, java.lang.String... channels)Add a new uniquely-named synchronous consumer that listens on a specified set of channels.ConsumerOperationsInterfaceaddConsumer(java.lang.String uniqueName, java.lang.String[] channels, boolean disconnectSlow)Deprecated.useaddConsumer(String, String[])in combination withEngineClientFactory.createEngineClient(String, int, String, boolean)ConsumerOperationsInterfaceaddConsumer(java.lang.String uniqueName, java.lang.String[] channels, boolean disconnectSlow, boolean async)Deprecated.useaddConsumer(String, String[])in combination withEngineClientFactory.createEngineClient(String, int, String, boolean)oraddAsyncConsumer(String, String[])to create an asynchronous consumervoidaddPropertyChangeListener(java.beans.PropertyChangeListener listener)Add a property change listener.voidaddPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)Add a property change listener for a specific named property.voidaddPropertyChangeListenerSync(java.beans.PropertyChangeListener listener)Add a property change listener (with synchronous notifications).voidaddPropertyChangeListenerSync(java.lang.String propertyName, java.beans.PropertyChangeListener listener)Add a property change listener for a specific named property.voidattachAsConsumerOfEngine(EngineClientBean sourceEngineBean, java.lang.String[] channels)Connect this engine to another (non-persisently) so that it receives events emitted on the specified channels.voidattachAsConsumerOfEngine(java.lang.String sourceHost, int sourcePort, java.lang.String[] channels)Connect this engine to another (non-persistently) so that it receives events emitted on the specified channels.voidattachAsConsumerOfEngine(java.lang.String sourceHost, int sourcePort, java.lang.String[] channels, boolean disconnectSlow)Connect this engine to another so that it receives events emitted on the specified channels.voidattachAsConsumerOfEngine(java.lang.String sourceHost, int sourcePort, java.lang.String[] channels, boolean disconnectSlow, ConnectMode mode)Connect this engine to another so that it receives events emitted on the specified channels.voidclose()Disconnects the client and also waits to ensure that all background threads and other resources associated with this object have been terminated or freed.voidconnectInBackground()Requests that the bean begins to establish a connection automatically in the background.voidconnectNow()Manually request that the bean connects to the remote server.voiddeleteAll()Deletes everything from the engine.voiddeleteName(java.lang.String name, boolean force)Delete a name from the engine.voiddeleteNames(java.util.List<java.lang.String> names, boolean force)Delete a number of names.voiddeleteNamesFromFile(java.util.List<java.lang.String> filenames, boolean force)Delete a number of names from a file or stdin.voiddeleteNamesFromFile(java.util.List<java.lang.String> filenames, boolean force, boolean utf8)Delete a number of names from a file or stdin.voiddetachAsConsumerOfEngine(EngineClientBean sourceEngineBean, java.lang.String[] channels)Disconnect this engine from another so that it not longer receives events emitted on the specified channels.voiddetachAsConsumerOfEngine(EngineClientBean sourceEngineBean, java.lang.String[] channels, ConnectMode mode)Disconnect this engine from another so that it not longer receives events emitted on the specified channels.voiddetachAsConsumerOfEngine(java.lang.String sourceHost, int sourcePort, java.lang.String[] channels)Disconnect this engine from another so that it not longer receives events emitted on the specified channels.voiddetachAsConsumerOfEngine(java.lang.String sourceHost, int sourcePort, java.lang.String[] channels, ConnectMode mode)Disconnect this engine from another so that it not longer receives events emitted on the specified channels.voiddisconnect()Sets the desired state of the bean to disconnected instead of connected, disconnects consumers and stops pinging the remote correlator to keep the connection alive.voiddispose()Deprecated.voidflushEvents()Wait for any outstanding events from previousSendOperationsInterface.sendEvents(Event...)orSendOperationsInterface.sendEvents(boolean, Event...)(where the boolean is true) calls into the Engine, and then return.voidflushListeners()Utility method that blocks until all pending property change listeners that have already fired have finished executing.ConsumerOperationsInterface[]getAllConsumers()Get all existing uniquely-named consumers.booleangetBeanConnected()Get the beanConnected property value.intgetConnectionPollingInterval()Get the polling interval (in milliseconds) for the background connection and ping thread.ConsumerOperationsInterfacegetConsumer(java.lang.String uniqueName)Get an existing uniquely-named consumer.EngineInfogetEngineInfo()Get the most recently recorded inspection information.java.lang.StringgetHost()Get the name of the host to be connected to.intgetInspectPollingInterval()Get the inspectPollingInterval (in milliseconds) that the background thread should wait between calls for new information.booleangetMonitorOnly()Getter for the monitorOnly property.intgetPort()Get the port number to be connected to.java.lang.StringgetProcessName()Get the process Name in use This is the process name in use for this bean The process name is a display name to identify which application is responsible for this connection to the Correlator (this name is included in log files for diagnostic purposes)booleangetReceiveOnly()Getter for the receiveOnly property.EngineConnection[]getReceiverConnections()Get all the persistent connections associated with the engine.EngineInfogetRemoteEngineInfo()Request the remote Engine inspection info.EngineStatusgetRemoteStatus()Request the remote Engine status.EngineStatusgetStatus()Get the most recently recorded status.intgetStatusPollingInterval()Get the statusPollingInterval (in milliseconds) that the background thread should wait between calls for new status information.booleangetVerbose()Getter for the verbose property.java.lang.String[]injectCDP(byte[] cdpBytes)Send the bytes of a CDP (Correlator Deployment Package) to the engine without blocking concurrent calls to operations on this bean instance.java.lang.String[]injectCDP(byte[] cdpBytes, java.lang.String filename)Send the bytes of a CDP (Correlator Deployment Package) to the engine without blocking concurrent calls to operations on this bean instance.java.lang.String[]injectCDPsFromFile(java.util.List<java.lang.String> filenames)Inject a collection of CDPs read from files (or stdin), without blocking concurrent calls to operations on this bean instance.java.lang.String[]injectJavaApplication(byte[] jarBytes)Send the bytes of a JMon application jar to the engine without blocking concurrent calls to operations on this bean instance.java.lang.String[]injectJavaApplicationsFromFile(java.util.List<java.lang.String> filenames)Inject a collection of JMon application jars read from files (or stdin), without blocking concurrent calls to operations on this bean instance.java.lang.String[]injectMonitorScript(MonitorScript script)Send MonitorScript text to the engine without blocking concurrent calls to operations on this bean instance.java.lang.String[]injectMonitorScript(MonitorScript script, java.lang.String filename)Send a MonitorScript object to the engine.java.lang.String[]injectMonitorScriptFromFile(java.lang.String... filenames)Inject a collection of MonitorScript text read from files (or stdin), without blocking concurrent calls to operations on this bean instance.java.lang.String[]injectMonitorScriptFromFile(java.util.List<java.lang.String> filenames)Inject a collection of MonitorScript text read from files (or stdin), without blocking concurrent calls to operations on this bean instance.java.lang.String[]injectMonitorScriptFromFile(java.util.List<java.lang.String> filenames, boolean utf8)Inject a number of monitors from a file or stdin.booleanisAllConsumersConnected()Determine if the bean and existing uniquely-named consumers are connected.booleanisBeanConnected()Another name for the getBeanConnected() method.booleanisDisconnectIfSlowReceiver()Whether any receiver will disconnect if it is slowbooleanisMonitorOnly()Another name for getMonitorOnly()booleanisReceiveOnly()Another name for getReceiveOnly()voidkillName(java.lang.String name)Kill a named monitor from the engine.voidkillNames(java.util.List<java.lang.String> names)Kill a number of named monitors.voidkillNamesFromFile(java.util.List<java.lang.String> filenames)Kill a number of named monitors from a file or stdin.voidkillNamesFromFile(java.util.List<java.lang.String> filenames, boolean utf8)Kill a number of names from a file or stdin.voidpingServer()Manually test if the remote engine process is alive and responding to client requests.voidremoveAllConsumers()Disconnect, Destroy, and Remove all existing consumers.voidremoveConsumer(java.lang.String uniqueName)Remove and disconnect an existing uniquely-named consumer.voidremovePropertyChangeListener(java.beans.PropertyChangeListener listener)Remove a property change listener.voidremovePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)Remove a property change listener for a specific named property.voidremovePropertyChangeListenerSync(java.beans.PropertyChangeListener listener)Remove a property change listener registered with addPropertyChangeListenerSync.voidremovePropertyChangeListenerSync(java.lang.String propertyName, java.beans.PropertyChangeListener listener)Remove a property change listener for a specific named property registered with addPropertyChangeListenerSync.voidsendEvents(boolean autoBatch, Event... events)Send events into the Engine, optionally not performing auto-batching.voidsendEvents(Event... events)Send an array of Event objects to the engine (automatically rebatching the actual event sending for efficiency).voidsendEventsFromFile(java.util.List<java.lang.String> filenames, int loop)Send a number of events from a file or stdin.voidsendEventsFromFile(java.util.List<java.lang.String> filenames, int loop, boolean utf8)Send a number of events from a file or stdin.voidsendEventsFromFile(java.util.List<java.lang.String> filenames, int loop, boolean utf8, boolean autoBatch)Send a number of events from a file or stdin, specifying the file encoding detection mode and whether to auto-batch events or not.voidsendEventsFromFile(java.util.List<java.lang.String> filenames, int loop, boolean utf8, boolean autoBatch, java.lang.String defaultChannel)Send a number of events from a file or stdin, specifying the file encoding detection mode and whether to auto-batch events or not.voidsetCancelDeleteFileRead(boolean newCancelFileReadValue)Setter for the cancelFileRead property for the Delete / Kill operations.voidsetCancelInjectFileRead(boolean newCancelFileReadValue)Setter for the cancelFileRead property for the Inject operations.voidsetCancelSendFileRead(boolean newCancelFileReadValue)Setter for the cancelFileRead property for the Send operations.voidsetConnectionPollingInterval(int milliseconds)Set the polling interval (in milliseconds) for the background connection and ping thread.voidsetHost(java.lang.String newHostValue)Setter for the host property.voidsetInspectPollingInterval(int newInspectPollingInterval)Set the inspectPollingInterval (in milliseconds) that the background thread should wait between calls for new information.voidsetMonitorOnly(boolean newMonitorOnlyValue)Setter for the monitorOnly property.voidsetPersistentReceiveConnections(EngineConnection... connections)Deprecated.usesetReceiverConnections(EngineConnection... )insteadvoidsetPort(int newPortValue)Setter for the port property.voidsetProcessName(java.lang.String newProcessName)Setter for the process Name This is the process name property to use.voidsetReceiveOnly(boolean newReceiveOnlyValue)Setter for the receiveOnly property.voidsetReceiverConnections(EngineConnection... connections)Attaches this component as a persistent receiver of the remote components specified in the connections argument, then decrements the reference count of any existing connections (which typically results in their removal).voidsetReconnectPeriod(long t)Set the minimum period between attempts to reconnect the bean and/or any of the bean's named consumers that have been disconnected (e.g.voidsetReconnectPolicy(ReconnectPolicyInterface p)Set a singleton reconnection policy that will be used to limit when reconnection can be attempted for the bean, and/or any of the bean's named consumers that have been disconnected (e.g.voidsetStatusPollingInterval(int newStatusPollingInterval)Set the statusPollingInterval (in milliseconds) that the background thread should wait between calls for new status information.voidsetVerbose(boolean newVerboseValue)Setter for the verbose property.voidstartInspectPollingThread()Start the local inspect polling thread.voidstartStatusPollingThread()Start the local status polling thread.voidstopInspectPollingThread()Stop the local inspect polling thread.voidstopStatusPollingThread()Stop the local status polling thread.java.lang.StringtoString()
-
-
-
Constructor Detail
-
EngineClientBean
public EngineClientBean()
Default constructor - as required to be a bean. Initialises the bean with default values for the properties. This default constructor does not make a connection to an Engine.If a bean class is not required, we recommend using the
EngineClientFactoryand the associated interfaces instead.
-
-
Method Detail
-
connectNow
public void connectNow() throws EngineExceptionManually request that the bean connects to the remote server. Repeated calls are permitted, and attempting to connect a bean that is already connected is identical to callingpingServer()from the PingOperationsInterface.- Specified by:
connectNowin interfaceBaseClientInterface- Specified by:
connectNowin interfaceEngineClientInterface- Throws:
EngineException- Thrown if any exceptions occur in the Client SDK.
-
connectInBackground
public void connectInBackground()
Requests that the bean begins to establish a connection automatically in the background.Calling
disconnect()will bring connection attempts to an end. Repeated calls to this method, or calling this method after a connection has already been established will have no effect.- Specified by:
connectInBackgroundin interfaceEngineClientInterface
-
pingServer
public void pingServer() throws EngineExceptionManually test if the remote engine process is alive and responding to client requests. This method makes a no-arg, void return, method call on the client interface of the engine. If a connection is not yet established, this method will request a connection. In the event that a connection cannot be established, or an error during the ping, an EngineException (which is a subclass of CompoundException) will be raised.- Specified by:
pingServerin interfaceEngineClientInterface- Specified by:
pingServerin interfacePingOperationsInterface- Throws:
EngineException- when the ping fails.
-
getHost
public java.lang.String getHost()
Get the name of the host to be connected to. This is the name of the host on which the correlator to be monitored is running.- Specified by:
getHostin interfaceBaseClientInterface- Returns:
- Name of the host where the correlator to be monitored is running.
-
setHost
public void setHost(java.lang.String newHostValue) throws EngineExceptionSetter for the host property. This is the name of the host on which the correlator to be monitored is running. Changing this property will cause any existing connection to be lost. If there was an existing connection, then a new connection will be created.- Specified by:
setHostin interfaceBaseClientInterface- Specified by:
setHostin interfaceEngineClientInterface- Parameters:
newHostValue- The new value for the Host property.- Throws:
EngineException- Thrown if any exceptions occur in the Client SDK.
-
getPort
public int getPort()
Get the port number to be connected to. This is the port number on which the correlator to be monitored is listening.- Specified by:
getPortin interfaceBaseClientInterface- Returns:
- Port number on which the correlator to be monitored is listening.
-
setPort
public void setPort(int newPortValue) throws EngineExceptionSetter for the port property. This is the port number on which the correlator to be monitored is listening. Changing this property will cause any existing connection to be lost. If there was an existing connection, then a new connection will be created.- Specified by:
setPortin interfaceBaseClientInterface- Specified by:
setPortin interfaceEngineClientInterface- Parameters:
newPortValue- The new value for the Port property.- Throws:
EngineException- Thrown if any exceptions occur in the Client SDK.
-
getProcessName
public java.lang.String getProcessName()
Get the process Name in use This is the process name in use for this bean The process name is a display name to identify which application is responsible for this connection to the Correlator (this name is included in log files for diagnostic purposes)- Specified by:
getProcessNamein interfaceBaseClientInterface- Returns:
- Process name in use
-
setProcessName
public void setProcessName(java.lang.String newProcessName) throws EngineExceptionSetter for the process Name This is the process name property to use. The process name is a display name to identify which application is responsible for this connection to the Correlator (this name is included in log files for diagnostic purposes) Changing this property will cause any existing connection to be lost. If there was an existing connection, then a new connection will be created.- Specified by:
setProcessNamein interfaceBaseClientInterface- Specified by:
setProcessNamein interfaceEngineClientInterface- Parameters:
newProcessName- The new value for the process name property.- Throws:
EngineException- Thrown if any exceptions occur in the Client SDK.
-
getMonitorOnly
public boolean getMonitorOnly()
Getter for the monitorOnly property. A bean running in "monitor only" mode cannot perform any state-changing operations on the remote component, nor can it receive events from it. Essentially it is limited to using the ping, inspect and watch operations only.- Returns:
- The value for the monitorOnly property.
-
isMonitorOnly
public boolean isMonitorOnly()
Another name for getMonitorOnly()- Returns:
- The value for the monitorOnly property.
-
setMonitorOnly
public void setMonitorOnly(boolean newMonitorOnlyValue) throws EngineExceptionSetter for the monitorOnly property. A bean running in "monitor only" mode cannot perform any state-changing operations on the remote component, nor can it receive events from it. Essentially it is limited to using the ping, inspect and watch operations only. Changing this property will cause any existing connection to be lost. If there was an existing connection, then a new connection will be created. Setting this property to true will reset the receiveOnly property to false.- Parameters:
newMonitorOnlyValue- The new value for the monitorOnly property.- Throws:
EngineException- If any exceptions occur in the Client SDK.
-
getReceiveOnly
public boolean getReceiveOnly()
Getter for the receiveOnly property. A bean running in "receive only" mode cannot perform any state-changing operations on the remote component, but it can receive events from it.- Returns:
- The value for the receiveOnly property.
-
isReceiveOnly
public boolean isReceiveOnly()
Another name for getReceiveOnly()- Returns:
- The value for the receiveOnly property.
-
setReceiveOnly
public void setReceiveOnly(boolean newReceiveOnlyValue) throws EngineExceptionSetter for the receiveOnly property. A bean running in "receive only" mode cannot perform any state-changing operations on the remote component, but it can receive events from it. Changing this property will cause any existing connection to be lost. If there was an existing connection, then a new connection will be created. Setting this property to true will reset the monitorOnly property to false.- Parameters:
newReceiveOnlyValue- The new value for the receiveOnly property.- Throws:
EngineException- If any exceptions occur in the Client SDK.
-
isBeanConnected
public boolean isBeanConnected()
Another name for the getBeanConnected() method.- Specified by:
isBeanConnectedin interfaceBaseClientInterface- Returns:
- true if the bean has a connection to an engine, false if not.
-
getBeanConnected
public boolean getBeanConnected()
Get the beanConnected property value. This is the status of the bean - connected, or not connected. It indicates if the EngineClientBean has a valid instance of the EngineManagement interface.- Specified by:
getBeanConnectedin interfaceBaseClientInterface- Returns:
- true if the bean has a connection to an engine, false if not.
-
getConnectionPollingInterval
public int getConnectionPollingInterval()
Get the polling interval (in milliseconds) for the background connection and ping thread.- Specified by:
getConnectionPollingIntervalin interfaceBaseClientInterface- Returns:
- the current interval in milliseconds
-
setConnectionPollingInterval
public void setConnectionPollingInterval(int milliseconds)
Set the polling interval (in milliseconds) for the background connection and ping thread.This controls how often the bean pings the engine, and updates the
BaseClientInterface.PROPERTY_BEAN_CONNECTEDproperty.If
connectInBackground()is used, if the bean lost its connection to the engine, or if any named consumers were disconnected (e.g. due to being slow), the polling interval also controls how often the bean attempts to automatically reconnect the bean and/or its registered consumers, subject to the minimum reconnect period specified bysetReconnectPeriod(long).- Specified by:
setConnectionPollingIntervalin interfaceBaseClientInterface- Parameters:
milliseconds- The polling interval in milliseconds. If negative, then the default value will be used instead.
-
getVerbose
public boolean getVerbose()
Getter for the verbose property. When verbose is set to true, some methods (in subclasses) will print progress messages on stdout.- Returns:
- Current value of the verbose property.
-
setVerbose
public void setVerbose(boolean newVerboseValue)
Setter for the verbose property. When verbose is set to true, some methods (in subclasses) will print progress messages on stdout.- Parameters:
newVerboseValue- Set to true for more verbose status output.
-
addPropertyChangeListener
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Description copied from interface:EngineClientInterfaceAdd a property change listener. Use this method to be informed whenever a property value is changed. Since Apama 5.2, listeners registered with this method will be called back asynchronously on a dedicated thread, which means it is permissible to call any engine client method from the listener - though be aware that the property value could have changed since the property change notification was fired, so may be different to the specified 'new value'. Applications that need the previous synchronous notification behaviour can use addPropertyChangeListenerSync to help with migration.- Specified by:
addPropertyChangeListenerin interfaceBaseClientInterface- Specified by:
addPropertyChangeListenerin interfaceEngineClientInterface- Parameters:
listener- the listener to be added.
-
removePropertyChangeListener
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Description copied from interface:EngineClientInterfaceRemove a property change listener.- Specified by:
removePropertyChangeListenerin interfaceBaseClientInterface- Specified by:
removePropertyChangeListenerin interfaceEngineClientInterface- Parameters:
listener- the listener to be removed.
-
addPropertyChangeListener
public void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)Description copied from interface:EngineClientInterfaceAdd a property change listener for a specific named property. Since Apama 5.2, listeners registered with this method will be called back asynchronously on a dedicated thread, which means it is permissible to call any engine client method from the listener - though be aware that the property value could have changed since the property change notification was fired, so may be different to the specified 'new value'. Applications that need the previous synchronous notification behaviour can use addPropertyChangeListenerSync to help with migration.- Specified by:
addPropertyChangeListenerin interfaceBaseClientInterface- Specified by:
addPropertyChangeListenerin interfaceEngineClientInterface- Parameters:
propertyName- the name of the property to listen on.listener- the listener to be added.
-
removePropertyChangeListener
public void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)Description copied from interface:EngineClientInterfaceRemove a property change listener for a specific named property.- Specified by:
removePropertyChangeListenerin interfaceBaseClientInterface- Specified by:
removePropertyChangeListenerin interfaceEngineClientInterface- Parameters:
propertyName- the name of the property that was listened on.listener- the listener to be removed.
-
addPropertyChangeListenerSync
public void addPropertyChangeListenerSync(java.beans.PropertyChangeListener listener)
Description copied from interface:EngineClientInterfaceAdd a property change listener (with synchronous notifications). This method is deprecated and applications should use addPropertyChangeListener instead wherever possible, however this method is provided to simplify migration from pre-5.2 Apama releases which provided synchronous listener behaviour by default. To avoid the possibility of deadlock, it is essential that listeners registered using this method do not attempt to make calls back into the engine client (or any other service that uses it).- Specified by:
addPropertyChangeListenerSyncin interfaceEngineClientInterface- Parameters:
listener- the listener to be added.
-
removePropertyChangeListenerSync
public void removePropertyChangeListenerSync(java.beans.PropertyChangeListener listener)
Description copied from interface:EngineClientInterfaceRemove a property change listener registered with addPropertyChangeListenerSync.- Specified by:
removePropertyChangeListenerSyncin interfaceEngineClientInterface- Parameters:
listener- the listener to be removed.
-
addPropertyChangeListenerSync
public void addPropertyChangeListenerSync(java.lang.String propertyName, java.beans.PropertyChangeListener listener)Description copied from interface:EngineClientInterfaceAdd a property change listener for a specific named property. This method is deprecated and applications should use addPropertyChangeListener instead wherever possible, however this method is provided to simplify migration from pre-5.2 Apama releases which provided synchronous listener behaviour by default. To avoid the possibility of deadlock, it is essential that listeners registered using this method do not attempt to make calls back into the engine client (or any other service that uses it).- Specified by:
addPropertyChangeListenerSyncin interfaceEngineClientInterface- Parameters:
propertyName- the name of the property to listen on.listener- the listener to be added.
-
removePropertyChangeListenerSync
public void removePropertyChangeListenerSync(java.lang.String propertyName, java.beans.PropertyChangeListener listener)Description copied from interface:EngineClientInterfaceRemove a property change listener for a specific named property registered with addPropertyChangeListenerSync.- Specified by:
removePropertyChangeListenerSyncin interfaceEngineClientInterface- Parameters:
propertyName- the name of the property that was listened on.listener- the listener to be removed.
-
flushListeners
public void flushListeners()
Description copied from interface:EngineClientInterfaceUtility method that blocks until all pending property change listeners that have already fired have finished executing. Mostly useful for testing.- Specified by:
flushListenersin interfaceEngineClientInterface
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
disconnect
public void disconnect() throws EngineExceptionSets the desired state of the bean to disconnected instead of connected, disconnects consumers and stops pinging the remote correlator to keep the connection alive.- Specified by:
disconnectin interfaceBaseClientInterface- Specified by:
disconnectin interfaceEngineClientInterface- Throws:
EngineException- Thrown if any exceptions occur in the Client SDK, specifically during de-registration of the internal EventConsumer.
-
close
public void close()
Description copied from interface:BaseClientInterfaceDisconnects the client and also waits to ensure that all background threads and other resources associated with this object have been terminated or freed. This method should always be called before quitting the program. Never call this method while the target object is locked, or from a thread that is receiving events or handling a property change notification event from the target object.This method is invoked automatically on objects managed by the try-with-resources statement.
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfaceBaseClientInterface- See Also:
AutoCloseable.close()
-
dispose
@Deprecated public void dispose()
Deprecated.Description copied from interface:BaseClientInterfaceDisconnects the client and also waits to ensure that all background threads and other resources associated with this object have been terminated or freed. This method should always be called before quitting the program. Never call this method while the target object is locked, or from a thread that is receiving events or handling a property change notification event from the target object.- Specified by:
disposein interfaceBaseClientInterface
-
setReconnectPolicy
public void setReconnectPolicy(ReconnectPolicyInterface p)
Description copied from interface:EngineClientInterfaceSet a singleton reconnection policy that will be used to limit when reconnection can be attempted for the bean, and/or any of the bean's named consumers that have been disconnected (e.g. as a slow consumer).In most cases, we recommend using
EngineClientInterface.setReconnectPeriod(long)instead of writing a custom policy object.- Specified by:
setReconnectPolicyin interfaceEngineClientInterface- See Also:
ReconnectPolicyInterface
-
setReconnectPeriod
public void setReconnectPeriod(long t)
Description copied from interface:EngineClientInterfaceSet the minimum period between attempts to reconnect the bean and/or any of the bean's named consumers that have been disconnected (e.g. as a slow consumer).By default there is no minimum reconnection period defined, and if any consumers have been disconnected by the engine, the bean will attempt to reconnect them at least as often as the bean's connection polling interval.
Any previously set reconnect policy will be overwritten when this method is called.
- Specified by:
setReconnectPeriodin interfaceEngineClientInterface- Parameters:
t- The minimum reconnection period in milliseconds, or 0 to place no limit on how often we can attempt to reconnect.- See Also:
EngineClientInterface.setReconnectPolicy(ReconnectPolicyInterface)
-
sendEventsFromFile
public void sendEventsFromFile(java.util.List<java.lang.String> filenames, int loop) throws EngineExceptionDescription copied from interface:SendOperationsInterfaceSend a number of events from a file or stdin.If a connection is not yet established, this method will request a connection.
The current implementation of this method does not perform automatic batching of the events, but a future release may change this behaviour, so please use the overloaded
SendOperationsInterface.sendEventsFromFile(List, int, boolean, boolean)method if you require control over this. Auto-batching will usually provide better throughput.NOTE: Change in behaviour at Apama 3.0 - previously we ignored any missing files, now an exception is thrown.
- Specified by:
sendEventsFromFilein interfaceSendOperationsInterface- Parameters:
filenames- Names of files to read event descriptions from. A file name "-" is taken to be stdin.loop- Loop count for repeated reading of input data.- Throws:
EngineException- Thrown if any exceptions occur in the Client SDK.
-
sendEventsFromFile
public void sendEventsFromFile(java.util.List<java.lang.String> filenames, int loop, boolean utf8) throws EngineExceptionDescription copied from interface:SendOperationsInterfaceSend a number of events from a file or stdin.If a connection is not yet established, this method will request a connection.
The current implementation of this method does not perform automatic batching of the events, but a future release may change this behaviour, so please use the overloaded
SendOperationsInterface.sendEventsFromFile(List, int, boolean, boolean)method if you require control over this. Auto-batching will usually provide better throughput.NOTE: Change in behaviour at Apama 3.0 - previously we ignored any missing files, now an exception is thrown.
- Specified by:
sendEventsFromFilein interfaceSendOperationsInterface- Parameters:
filenames- Names of files to read event descriptions from. A file name "-" is taken to be stdin.loop- Loop count for repeated reading of input data.utf8- Iftrue, the specified files will be read as UTF-8; otherwise they will be read using the system default encoding unless they begin with a unicode Byte Order Mark (BOM) character.- Throws:
EngineException- Thrown if any exceptions occur in the Client SDK.
-
sendEventsFromFile
public void sendEventsFromFile(java.util.List<java.lang.String> filenames, int loop, boolean utf8, boolean autoBatch) throws EngineExceptionDescription copied from interface:SendOperationsInterfaceSend a number of events from a file or stdin, specifying the file encoding detection mode and whether to auto-batch events or not.If a connection is not yet established, this method will request a connection.
NOTE: Change in behaviour at Apama 3.0 - previously we ignored any missing files, now an exception is thrown.
- Specified by:
sendEventsFromFilein interfaceSendOperationsInterface- Parameters:
filenames- Names of files to read event descriptions from. A file name "-" is taken to be stdin.loop- Loop count for repeated reading of input data.utf8- Iftrue, the specified files will be read as UTF-8; otherwise they will be read using the system default encoding unless they begin with a unicode Byte Order Mark (BOM) character.autoBatch- Iftrue, events will be automatically rebatched to improve throughput- Throws:
EngineException- Thrown if any exceptions occur in the Client SDK.
-
sendEventsFromFile
public void sendEventsFromFile(java.util.List<java.lang.String> filenames, int loop, boolean utf8, boolean autoBatch, java.lang.String defaultChannel) throws EngineExceptionDescription copied from interface:SendOperationsInterfaceSend a number of events from a file or stdin, specifying the file encoding detection mode and whether to auto-batch events or not.If a connection is not yet established, this method will request a connection.
NOTE: Change in behaviour at Apama 3.0 - previously we ignored any missing files, now an exception is thrown.
- Specified by:
sendEventsFromFilein interfaceSendOperationsInterface- Parameters:
filenames- Names of files to read event descriptions from. A file name "-" is taken to be stdin.loop- Loop count for repeated reading of input data.utf8- Iftrue, the specified files will be read as UTF-8; otherwise they will be read using the system default encoding unless they begin with a unicode Byte Order Mark (BOM) character.autoBatch- Iftrue, events will be automatically rebatched to improve throughputdefaultChannel- Channel to use for events which aren't specified in the input file- Throws:
EngineException- Thrown if any exceptions occur in the Client SDK.
-
sendEvents
public void sendEvents(boolean autoBatch, Event... events) throws EngineExceptionSend events into the Engine, optionally not performing auto-batching. If a connection is not yet established, this method will request a connection.- Specified by:
sendEventsin interfaceSendOperationsInterface- Parameters:
autoBatch- Iftrue, events will be automatically rebatched to improve throughput (across separate sendEvents calls)events- The array of Events to be sent.- Throws:
EngineException- Thrown if any exceptions occur in the Client SDK.- See Also:
SendOperationsInterface.flushEvents()
-
sendEvents
public void sendEvents(Event... events) throws EngineException
Description copied from interface:SendOperationsInterfaceSend an array of Event objects to the engine (automatically rebatching the actual event sending for efficiency). Please use the overloadedSendOperationsInterface.sendEvents(boolean, Event...)method if you require control over the rebatching. If a connection is not yet established, this method will request a connection.- Specified by:
sendEventsin interfaceSendOperationsInterface- Parameters:
events- An array with one or more Events to be sent.- Throws:
EngineException- Thrown if any exceptions occur in the Client SDK.- See Also:
SendOperationsInterface.flushEvents()
-
flushEvents
public void flushEvents() throws EngineException, java.lang.InterruptedExceptionWait for any outstanding events from previousSendOperationsInterface.sendEvents(Event...)orSendOperationsInterface.sendEvents(boolean, Event...)(where the boolean is true) calls into the Engine, and then return.- Specified by:
flushEventsin interfaceSendOperationsInterface- Throws:
EngineException- Thrown if any exceptions occur in the Client SDK.java.lang.InterruptedException- Thrown if this thread is interrupted while waiting for outstanding events to be sent and acknowledged (seeThread.interrupt().- See Also:
SendOperationsInterface.sendEvents(boolean, Event...)
-
setCancelSendFileRead
public void setCancelSendFileRead(boolean newCancelFileReadValue)
Setter for the cancelFileRead property for the Send operations. The purpose of the cancelFileRead property is to provide a mechanism to cleanly terminate the processing of events from file, when the sendEventsFromFile() method is in progress. When cancelFileRead is set to true, the event sending loop will terminate at the next iteration.- Specified by:
setCancelSendFileReadin interfaceSendOperationsInterface- Parameters:
newCancelFileReadValue- New value for the cancelFileRead property.
-
deleteNames
public void deleteNames(java.util.List<java.lang.String> names, boolean force) throws EngineExceptionDelete a number of names. If a connection is not yet established, this method will request a connection.- Specified by:
deleteNamesin interfaceDeleteOperationsInterface- Parameters:
names- Names to be deleted.force- Set to true to forcably delete the names even if in use.- Throws:
EngineException
-
deleteNamesFromFile
public void deleteNamesFromFile(java.util.List<java.lang.String> filenames, boolean force) throws EngineExceptionDelete a number of names from a file or stdin. If a connection is not yet established, this method will request a connection.- Specified by:
deleteNamesFromFilein interfaceDeleteOperationsInterface- Parameters:
filenames- Names of files to read Names from. A file name "-" is taken to be stdin.force- Set to true to forcably delete the names even if in use.- Throws:
EngineException- Thrown if any exceptions occur in the Client SDK.
-
deleteNamesFromFile
public void deleteNamesFromFile(java.util.List<java.lang.String> filenames, boolean force, boolean utf8) throws EngineExceptionDescription copied from interface:DeleteOperationsInterfaceDelete a number of names from a file or stdin. If a connection is not yet established, this method will request a connection.- Specified by:
deleteNamesFromFilein interfaceDeleteOperationsInterface- Parameters:
filenames- Names of files to read Names from. A file name "-" is taken to be stdin.force- Set to true to forcably delete the names even if in use.utf8- Iftrue, the specified files will be read as UTF-8; otherwise they will be read using the system default encoding unless they begin with a unicode Byte Order Mark (BOM) character.- Throws:
EngineException- Thrown if any exceptions occur in the Client SDK.
-
deleteAll
public void deleteAll() throws EngineExceptionDeletes everything from the engine.- Specified by:
deleteAllin interfaceDeleteOperationsInterface- Throws:
EngineException
-
deleteName
public void deleteName(java.lang.String name, boolean force) throws EngineExceptionDelete a name from the engine. If a connection is not yet established, this method will request a connection.- Specified by:
deleteNamein interfaceDeleteOperationsInterface- Parameters:
name- The name to be deleted.force- Set to true to forcably delete the name even if in use.- Throws:
EngineException- Thrown if any exceptions occur in the Client SDK.
-
killNames
public void killNames(java.util.List<java.lang.String> names) throws EngineExceptionKill a number of named monitors. Note that this will kill running monitors in such as way as to break the fault tolerance scheme. If a connection is not yet established, this method will request a connection.- Specified by:
killNamesin interfaceDeleteOperationsInterface- Parameters:
names- Names to be deleted.- Throws:
EngineException
-
killNamesFromFile
public void killNamesFromFile(java.util.List<java.lang.String> filenames) throws EngineExceptionKill a number of named monitors from a file or stdin. Note that this will kill running monitors in such as way as to break the fault tolerance scheme. If a connection is not yet established, this method will request a connection.- Specified by:
killNamesFromFilein interfaceDeleteOperationsInterface- Parameters:
filenames- Names of files to read Names from. A file name "-" is taken to be stdin.- Throws:
EngineException- Thrown if any exceptions occur in the Client SDK.
-
killNamesFromFile
public void killNamesFromFile(java.util.List<java.lang.String> filenames, boolean utf8) throws EngineExceptionDescription copied from interface:DeleteOperationsInterfaceKill a number of names from a file or stdin. Note that this will kill running monitors in such as way as to break the fault tolerance scheme. If a connection is not yet established, this method will request a connection.- Specified by:
killNamesFromFilein interfaceDeleteOperationsInterface- Parameters:
filenames- Names of files to read Names from. A file name "-" is taken to be stdin.utf8- Iftrue, the specified files will be read as UTF-8; otherwise they will be read using the system default encoding unless they begin with a unicode Byte Order Mark (BOM) character.- Throws:
EngineException- Thrown if any exceptions occur in the Client SDK.
-
killName
public void killName(java.lang.String name) throws EngineExceptionKill a named monitor from the engine. Note that this will kill running monitors in such as way as to break the fault tolerance scheme. If a connection is not yet established, this method will request a connection.- Specified by:
killNamein interfaceDeleteOperationsInterface- Parameters:
name- The name to be deleted.- Throws:
EngineException- Thrown if any exceptions occur in the Client SDK.
-
setCancelDeleteFileRead
public void setCancelDeleteFileRead(boolean newCancelFileReadValue)
Setter for the cancelFileRead property for the Delete / Kill operations. The purpose of the cancelFileRead property is to provide a mechanism to cleanly terminate the processing of events from file, when the deleteNamesFromFile() or killNamesFromFile() method is in progress. When cancelFileRead is set to true, the Name deleting loop will terminate at the next iteration.- Specified by:
setCancelDeleteFileReadin interfaceDeleteOperationsInterface- Parameters:
newCancelFileReadValue- New value for the cancelFileRead property.
-
injectMonitorScriptFromFile
public java.lang.String[] injectMonitorScriptFromFile(java.lang.String... filenames) throws EngineExceptionInject a collection of MonitorScript text read from files (or stdin), without blocking concurrent calls to operations on this bean instance. If a connection to the engine is not yet established, this method will attempt to make a connection.- Specified by:
injectMonitorScriptFromFilein interfaceInjectOperationsInterface- Parameters:
filenames- Names of files containing MonitorScript text to be injected. Standard input is represented by a filename "-". This special filename should only occur no more than once in the filename list.- Returns:
- An array of warnings (may be zero length)
- Throws:
EngineException- If any of the named files cannot be injected, either because the file could not be read or because a call to injectMonitorScriptUnlocked() failed.
-
injectMonitorScriptFromFile
public java.lang.String[] injectMonitorScriptFromFile(java.util.List<java.lang.String> filenames) throws EngineExceptionInject a collection of MonitorScript text read from files (or stdin), without blocking concurrent calls to operations on this bean instance. If a connection to the engine is not yet established, this method will attempt to make a connection.- Specified by:
injectMonitorScriptFromFilein interfaceInjectOperationsInterface- Parameters:
filenames- Names of files containing MonitorScript text to be injected. Standard input is represented by a filename "-". This special filename should only occur once in the filename vector.- Returns:
- An array of warnings (may be zero length)
- Throws:
EngineException- If any of the named files cannot be injected, either because the file could not be read or because a call to injectMonitorScriptUnlocked() failed.
-
injectMonitorScriptFromFile
public java.lang.String[] injectMonitorScriptFromFile(java.util.List<java.lang.String> filenames, boolean utf8) throws EngineExceptionDescription copied from interface:InjectOperationsInterfaceInject a number of monitors from a file or stdin. If a connection is not yet established, this method will request a connection.- Specified by:
injectMonitorScriptFromFilein interfaceInjectOperationsInterface- Parameters:
filenames- Names of files to read MonitorScript text from. A file name "-" is taken to be stdin.utf8- Iftrue, the specified files will be read as UTF-8; otherwise they will be read using the system default encoding unless they begin with a unicode Byte Order Mark (BOM) character.- Returns:
- An array of strings which are the set of warnings generated by the MonitorScript compiler. May be zero length.
- Throws:
EngineException- Thrown if any exceptions occur in the Client SDK. This exception may contain warnings.
-
injectMonitorScript
public java.lang.String[] injectMonitorScript(MonitorScript script) throws EngineException
Send MonitorScript text to the engine without blocking concurrent calls to operations on this bean instance. If a connection to the engine is not yet established, this method will attempt to make a connection.- Specified by:
injectMonitorScriptin interfaceInjectOperationsInterface- Parameters:
script- The MonitorScript object to be injected into the engine.- Returns:
- An array of warnings (may be zero length).
- Throws:
EngineException- If the MonitorScript is rejected by the engine, or there is a problem sending the script.
-
injectMonitorScript
public java.lang.String[] injectMonitorScript(MonitorScript script, java.lang.String filename) throws EngineException
Description copied from interface:InjectOperationsInterfaceSend a MonitorScript object to the engine. If a connection is not yet established, this method will request a connection.- Specified by:
injectMonitorScriptin interfaceInjectOperationsInterface- Parameters:
script- The MonitorScript object to be sent.filename- The file the monitorscript came from (may be null)- Returns:
- An array of strings which are the set of warnings generated by the MonitorScript compiler. May be zero length.
- Throws:
EngineException- When failures happen. This exception may contain warnings.
-
injectJavaApplicationsFromFile
public java.lang.String[] injectJavaApplicationsFromFile(java.util.List<java.lang.String> filenames) throws EngineExceptionInject a collection of JMon application jars read from files (or stdin), without blocking concurrent calls to operations on this bean instance. If a connection to the engine is not yet established, this method will attempt to make a connection.- Specified by:
injectJavaApplicationsFromFilein interfaceInjectOperationsInterface- Parameters:
filenames- Names of files containing JMon applications to be injected. Standard input is represented by a filename "-". This special filename should only occur once in the filename vector.- Returns:
- An array of warnings
- Throws:
EngineException- If any of the named files cannot be injected, either because the file could not be read or for another reason.
-
injectJavaApplication
public java.lang.String[] injectJavaApplication(byte[] jarBytes) throws EngineExceptionSend the bytes of a JMon application jar to the engine without blocking concurrent calls to operations on this bean instance. If a connection to the engine is not yet established, this method will attempt to make a connection.- Specified by:
injectJavaApplicationin interfaceInjectOperationsInterface- Parameters:
jarBytes- The contents of the JMon jar to be sent to the engine.- Returns:
- An array of strings which are the set of warnings about the JMon application. May be zero length.
- Throws:
EngineException- If the JMon application is rejected by the engine, or there is a problem sending the data.
-
injectCDPsFromFile
public java.lang.String[] injectCDPsFromFile(java.util.List<java.lang.String> filenames) throws EngineExceptionInject a collection of CDPs read from files (or stdin), without blocking concurrent calls to operations on this bean instance. If a connection to the engine is not yet established, this method will attempt to make a connection.- Specified by:
injectCDPsFromFilein interfaceInjectOperationsInterface- Parameters:
filenames- Names of files containing CDP files to be injected. Standard input is represented by a filename "-". This special filename should only occur once in the filename vector.- Returns:
- An array of warnings
- Throws:
EngineException- If any of the named files cannot be injected, either because the file could not be read or for another reason.
-
injectCDP
public java.lang.String[] injectCDP(byte[] cdpBytes) throws EngineExceptionSend the bytes of a CDP (Correlator Deployment Package) to the engine without blocking concurrent calls to operations on this bean instance. If a connection to the engine is not yet established, this method will attempt to make a connection.- Parameters:
cdpBytes- The contents of the CDP file to be sent to the engine.- Returns:
- An array of warnings (may be zero length).
- Throws:
EngineException- If the CDP file is rejected by the engine, or there is a problem sending the data.
-
injectCDP
public java.lang.String[] injectCDP(byte[] cdpBytes, java.lang.String filename) throws EngineExceptionSend the bytes of a CDP (Correlator Deployment Package) to the engine without blocking concurrent calls to operations on this bean instance. If a connection to the engine is not yet established, this method will attempt to make a connection.- Specified by:
injectCDPin interfaceInjectOperationsInterface- Parameters:
cdpBytes- The contents of the CDP file to be sent to the engine.filename- The name of the file we are injecting from.- Returns:
- An array of strings which are the set of warnings about the CDP. May be zero length.
- Throws:
EngineException- If the CDP file is rejected by the engine, or there is a problem sending the data.
-
setCancelInjectFileRead
public void setCancelInjectFileRead(boolean newCancelFileReadValue)
Setter for the cancelFileRead property for the Inject operations. The purpose of the cancelFileRead property is to provide a mechanism to cleanly terminate the processing of MonitorScripts from file, when the injectMonitorScriptFromFile() method is in progress. When cancelFileRead is set to true, the MonitorScript injecting loop will terminate at the next iteration.- Specified by:
setCancelInjectFileReadin interfaceInjectOperationsInterface- Parameters:
newCancelFileReadValue- New value for the cancelFileRead property.
-
startInspectPollingThread
public void startInspectPollingThread() throws EngineExceptionStart the local inspect polling thread. If a connection is not yet established, this method will request a connection.- Specified by:
startInspectPollingThreadin interfaceInspectOperationsInterface- Throws:
EngineException- Thrown if any exceptions occur in the Client SDK.
-
stopInspectPollingThread
public void stopInspectPollingThread()
Stop the local inspect polling thread.- Specified by:
stopInspectPollingThreadin interfaceInspectOperationsInterface
-
getRemoteEngineInfo
public EngineInfo getRemoteEngineInfo() throws EngineException
Request the remote Engine inspection info. This method will not store the inspection result, and is available as an alternative to the background polling service. If a connection is not yet established, this method will request a connection.- Specified by:
getRemoteEngineInfoin interfaceInspectOperationsInterface- Returns:
- the information found as obtained by directly inspecting the Engine.
- Throws:
EngineException- Thrown if any exceptions occur in the Client SDK.
-
setInspectPollingInterval
public void setInspectPollingInterval(int newInspectPollingInterval)
Set the inspectPollingInterval (in milliseconds) that the background thread should wait between calls for new information.- Specified by:
setInspectPollingIntervalin interfaceInspectOperationsInterface- Parameters:
newInspectPollingInterval- Polling interval in milliseconds.
-
getInspectPollingInterval
public int getInspectPollingInterval()
Get the inspectPollingInterval (in milliseconds) that the background thread should wait between calls for new information.- Specified by:
getInspectPollingIntervalin interfaceInspectOperationsInterface- Returns:
- Polling interval in milliseconds.
-
attachAsConsumerOfEngine
public void attachAsConsumerOfEngine(EngineClientBean sourceEngineBean, java.lang.String[] channels) throws EngineException
Description copied from interface:ConnectOperationsInterfaceConnect this engine to another (non-persisently) so that it receives events emitted on the specified channels. This is equivalent to the engine_connect command.
Note: If you do not already have a connected EngineClientBean instance for the source engine, it is usually more efficient to call the overloaded ConnectOperationsInterface#attachAsConsumerOfEngine(String, int, String[]) method which takes a source host and port instead.- Specified by:
attachAsConsumerOfEnginein interfaceConnectOperationsInterface- Parameters:
sourceEngineBean- The EngineClientBean instance for the engine to receive from.channels- the list of channels from which the engine should receive events. Must be non-null, and contain no null elements.- Throws:
EngineException- if the engines cannot be connected, or if the channels parameter is invalid.
-
attachAsConsumerOfEngine
public void attachAsConsumerOfEngine(java.lang.String sourceHost, int sourcePort, java.lang.String[] channels) throws EngineExceptionDescription copied from interface:ConnectOperationsInterfaceConnect this engine to another (non-persistently) so that it receives events emitted on the specified channels. This is equivalent to the engine_connect command.- Specified by:
attachAsConsumerOfEnginein interfaceConnectOperationsInterface- Parameters:
sourceHost- The host of the engine to receive from.sourcePort- The port of the engine to receive from.channels- the list of channels from which the engine should receive events. Must be non-null, and contain no null elements.- Throws:
EngineException- if the engines cannot be connected, or if the channels parameter is invalid.
-
attachAsConsumerOfEngine
public void attachAsConsumerOfEngine(java.lang.String sourceHost, int sourcePort, java.lang.String[] channels, boolean disconnectSlow) throws EngineExceptionDescription copied from interface:ConnectOperationsInterfaceConnect this engine to another so that it receives events emitted on the specified channels. This is equivalent to the engine_connect command.- Specified by:
attachAsConsumerOfEnginein interfaceConnectOperationsInterface- Parameters:
sourceHost- The host of the engine to receive from.sourcePort- The port of the engine to receive from.channels- the list of channels from which the engine should receive events. Must be non-null, and contain no null elements.disconnectSlow- Whether we should be disconnected if we don't keep up. Only the first connection's disconnectSlow value is used; subsequent connections to the same correlator (even if via different EngineManagement objects) share the connection and thus the disconnect behaviour.- Throws:
EngineException- if the engines cannot be connected, or if the channels parameter is invalid.
-
attachAsConsumerOfEngine
public void attachAsConsumerOfEngine(java.lang.String sourceHost, int sourcePort, java.lang.String[] channels, boolean disconnectSlow, ConnectMode mode) throws EngineExceptionDescription copied from interface:ConnectOperationsInterfaceConnect this engine to another so that it receives events emitted on the specified channels. This is equivalent to the engine_connect command.- Specified by:
attachAsConsumerOfEnginein interfaceConnectOperationsInterface- Parameters:
sourceHost- The host of the engine to receive from.sourcePort- The port of the engine to receive from.channels- the list of channels from which the engine should receive events. Must be non-null, and contain no null elements.disconnectSlow- Whether we should be disconnected if we don't keep up. Only the first connection's disconnectSlow value is used; subsequent connections to the same correlator (even if via different EngineManagement objects) share the connection and thus the disconnect behaviour.mode- the connection mode to use, defaults to legacy (single connection, all events delivered to the default channel). Set to PARALLEL for connection per channel and channel values passed through.- Throws:
EngineException- if the engines cannot be connected, or if the channels parameter is invalid.
-
detachAsConsumerOfEngine
public void detachAsConsumerOfEngine(EngineClientBean sourceEngineBean, java.lang.String[] channels) throws EngineException
Description copied from interface:ConnectOperationsInterfaceDisconnect this engine from another so that it not longer receives events emitted on the specified channels. This is equivalent to theengine_connect --disconnectcommand, and assumes the connection is non-persistent.- Specified by:
detachAsConsumerOfEnginein interfaceConnectOperationsInterface- Parameters:
sourceEngineBean- The EngineClientBean instance for the engine this object is currently connected to as a consumer.channels- the list of channels from which the engine should receive events. Must be non-null, and contain no null elements.- Throws:
EngineException- if the engines cannot be disconnected, or if the channels parameter is invalid.
-
detachAsConsumerOfEngine
public void detachAsConsumerOfEngine(EngineClientBean sourceEngineBean, java.lang.String[] channels, ConnectMode mode) throws EngineException
Description copied from interface:ConnectOperationsInterfaceDisconnect this engine from another so that it not longer receives events emitted on the specified channels. This is equivalent to theengine_connect --disconnectcommand, and assumes the connection is non-persistent.- Specified by:
detachAsConsumerOfEnginein interfaceConnectOperationsInterface- Parameters:
sourceEngineBean- The EngineClientBean instance for the engine this object is currently connected to as a consumer.channels- the list of channels from which the engine should receive events. Must be non-null, and contain no null elements.mode- the connection mode to use, defaults to legacy (single connection, all events delivered to the default channel). Set to PARALLEL for connection per channel and channel values passed through.- Throws:
EngineException- if the engines cannot be disconnected, or if the channels parameter is invalid.
-
detachAsConsumerOfEngine
public void detachAsConsumerOfEngine(java.lang.String sourceHost, int sourcePort, java.lang.String[] channels) throws EngineExceptionDescription copied from interface:ConnectOperationsInterfaceDisconnect this engine from another so that it not longer receives events emitted on the specified channels. This is equivalent to theengine_connect --disconnectcommand, and assumes the connection is non-persistent.- Specified by:
detachAsConsumerOfEnginein interfaceConnectOperationsInterface- Parameters:
sourceHost- The host of the engine this object is currently connected to as a consumer.sourcePort- The port of the engine this object is currently connected to as a consumer.channels- the list of channels from which the engine should receive events. Must be non-null, and contain no null elements.- Throws:
EngineException- if the engines cannot be disconnected, or if the channels parameter is invalid.
-
detachAsConsumerOfEngine
public void detachAsConsumerOfEngine(java.lang.String sourceHost, int sourcePort, java.lang.String[] channels, ConnectMode mode) throws EngineExceptionDescription copied from interface:ConnectOperationsInterfaceDisconnect this engine from another so that it not longer receives events emitted on the specified channels. This is equivalent to theengine_connect --disconnectcommand, and assumes the connection is non-persistent.- Specified by:
detachAsConsumerOfEnginein interfaceConnectOperationsInterface- Parameters:
sourceHost- The host of the engine this object is currently connected to as a consumer.sourcePort- The port of the engine this object is currently connected to as a consumer.channels- the list of channels from which the engine should receive events. Must be non-null, and contain no null elements.mode- the connection mode to use, defaults to legacy (single connection, all events delivered to the default channel). Set to PARALLEL for connection per channel and channel values passed through.- Throws:
EngineException- if the engines cannot be disconnected, or if the channels parameter is invalid.
-
setPersistentReceiveConnections
@Deprecated public void setPersistentReceiveConnections(EngineConnection... connections) throws EngineException
Deprecated.usesetReceiverConnections(EngineConnection... )insteadAttaches this component as a persistent receiver of the remote components specified in the connections argument, then decrements the reference count of any existing connections (which typically results in their removal).- Specified by:
setPersistentReceiveConnectionsin interfaceConnectOperationsInterface- Parameters:
connections- Must not containnullelements.- Throws:
EngineException- If the change in the persistent connection set failed. Note that no exception is thrown if some of the specified connections could not be established immediately - in this case the receiver will simply keep trying to reconnect in the background.
-
setReceiverConnections
public void setReceiverConnections(EngineConnection... connections) throws EngineException
Attaches this component as a persistent receiver of the remote components specified in the connections argument, then decrements the reference count of any existing connections (which typically results in their removal).- Specified by:
setReceiverConnectionsin interfaceConnectOperationsInterface- Parameters:
connections- Must not containnullelements.- Throws:
EngineException- If the change in the persistent connection set failed. Note that no exception is thrown if some of the specified connections could not be established immediately - in this case the receiver will simply keep trying to reconnect in the background.
-
getReceiverConnections
public EngineConnection[] getReceiverConnections() throws EngineException
Get all the persistent connections associated with the engine.- Specified by:
getReceiverConnectionsin interfaceConnectOperationsInterface- Returns:
- an array of EngineConnection objects.
- Throws:
EngineException- Thrown if any exceptions occur in the Client SDK.
-
getEngineInfo
public EngineInfo getEngineInfo()
Get the most recently recorded inspection information. Note that calling this method does NOT invoke a remote call to a correlator, but simply returns the last known information as collected by the internal worker thread, if that thread is running.- Specified by:
getEngineInfoin interfaceInspectOperationsInterface- Returns:
- the most recently recorded EngineInfo object. To be informed whenever the information changes, register a property change listener.
-
startStatusPollingThread
public void startStatusPollingThread() throws EngineExceptionStart the local status polling thread. If a connection is not yet established, this method will request a connection.- Specified by:
startStatusPollingThreadin interfaceWatchOperationsInterface- Throws:
EngineException- Thrown if any exceptions occur in the Client SDK.
-
stopStatusPollingThread
public void stopStatusPollingThread()
Stop the local status polling thread.- Specified by:
stopStatusPollingThreadin interfaceWatchOperationsInterface
-
getRemoteStatus
public EngineStatus getRemoteStatus() throws EngineException
Request the remote Engine status. This method will not store the status result, and is available as an alternative to the background polling service. If a connection is not yet established, this method will request a connection.- Specified by:
getRemoteStatusin interfaceWatchOperationsInterface- Returns:
- The status as obtained directly from an Engine.
- Throws:
EngineException- Thrown if any exceptions occur in the Client SDK.
-
setStatusPollingInterval
public void setStatusPollingInterval(int newStatusPollingInterval)
Set the statusPollingInterval (in milliseconds) that the background thread should wait between calls for new status information.- Specified by:
setStatusPollingIntervalin interfaceWatchOperationsInterface- Parameters:
newStatusPollingInterval- Polling interval in milliseconds.
-
getStatusPollingInterval
public int getStatusPollingInterval()
Get the statusPollingInterval (in milliseconds) that the background thread should wait between calls for new status information.- Specified by:
getStatusPollingIntervalin interfaceWatchOperationsInterface- Returns:
- Polling interval in milliseconds.
-
getStatus
public EngineStatus getStatus()
Get the most recently recorded status. Note that calling this method does NOT invoke a remote call to a correlator, but simply returns the last known status as collected by the internal worker thread.- Specified by:
getStatusin interfaceWatchOperationsInterface- Returns:
- the most recently status object. To be informed whenever the status changes, register a property change listener.
-
addConsumer
public ConsumerOperationsInterface addConsumer(java.lang.String uniqueName, java.lang.String... channels) throws EngineException
Add a new uniquely-named synchronous consumer that listens on a specified set of channels. The consumer will default to being synchronous (i.e. the event listener MUST not call ANY methods on the EngineClientBean, for example sendEvents()). The consumer will disconnect if it is slow, ifdisconnectSlowReceiverwas set totruewhile creating the EngineClient instance usingEngineClientFactory.createEngineClient(String, int, String, boolean)- Specified by:
addConsumerin interfaceReceiveConsumerOperationsInterface- Parameters:
uniqueName- the unique name for the new consumer.channels- the list of channels on which the consumer should receive events.- Returns:
- the new consumer.
- Throws:
EngineException- if the consumer cannot be added (e.g. if the name is not unique)
-
addAsyncConsumer
public ConsumerOperationsInterface addAsyncConsumer(java.lang.String uniqueName, java.lang.String... channels) throws EngineException
Add a new uniquely-named asynchronous consumer that listens on a specified set of channels. The consumer will be asynchronous (i.e. disconnect() doesn't wait for the consumer. Also the event listener can call any methods on the EngineClientBean, for example sendEvents()). The consumer will disconnect if it is slow, ifdisconnectSlowReceiverwas set totruewhile creating the EngineClient instance usingEngineClientFactory.createEngineClient(String, int, String, boolean)- Specified by:
addAsyncConsumerin interfaceReceiveConsumerOperationsInterface- Parameters:
uniqueName- the unique name for the new consumer.channels- the list of channels on which the consumer should receive events.- Returns:
- the new consumer.
- Throws:
EngineException- if the consumer cannot be added (e.g. if the name is not unique)
-
addConsumer
@Deprecated public ConsumerOperationsInterface addConsumer(java.lang.String uniqueName, java.lang.String[] channels, boolean disconnectSlow) throws EngineException
Deprecated.useaddConsumer(String, String[])in combination withEngineClientFactory.createEngineClient(String, int, String, boolean)Add a new uniquely-named consumer that listens on a specified set of channels. The consumer will be synchronous (i.e. the event listener MUST not call ANY methods on the EngineClientBean, for example sendEvents()).- Specified by:
addConsumerin interfaceReceiveConsumerOperationsInterface- Parameters:
uniqueName- the unique name for the new consumer.channels- the list of channels on which the consumer should receive events.disconnectSlow- whether we should be disconnected if we don't keep up.- Returns:
- the new consumer.
- Throws:
EngineException- if the consumer cannot be added (e.g. if the name is not unique)
-
addConsumer
@Deprecated public ConsumerOperationsInterface addConsumer(java.lang.String uniqueName, java.lang.String[] channels, boolean disconnectSlow, boolean async) throws EngineException
Deprecated.useaddConsumer(String, String[])in combination withEngineClientFactory.createEngineClient(String, int, String, boolean)oraddAsyncConsumer(String, String[])to create an asynchronous consumerAdd a new uniquely-named consumer that listens on a specified set of channels.- Specified by:
addConsumerin interfaceReceiveConsumerOperationsInterface- Parameters:
uniqueName- the unique name for the new consumer.channels- the list of channels on which the consumer should receive events.disconnectSlow- whether we should be disconnected if we don't keep up.async- whether the consumer is asynchronous - i.e. disconnect() doesn't wait for it. Only consumers with async set totruemay call bean methods in their event listener.- Returns:
- the new consumer.
- Throws:
EngineException- if the consumer cannot be added (e.g. if the name is not unique)
-
getConsumer
public ConsumerOperationsInterface getConsumer(java.lang.String uniqueName)
Get an existing uniquely-named consumer.- Specified by:
getConsumerin interfaceReceiveConsumerOperationsInterface- Parameters:
uniqueName- the unique-name of an existing consumer.- Returns:
- the existing consumer, or null if one cannot be found with the specified name.
-
getAllConsumers
public ConsumerOperationsInterface[] getAllConsumers()
Get all existing uniquely-named consumers.- Specified by:
getAllConsumersin interfaceReceiveConsumerOperationsInterface- Returns:
- the array of all existing consumers.
-
isAllConsumersConnected
public boolean isAllConsumersConnected()
Description copied from interface:ReceiveConsumerOperationsInterfaceDetermine if the bean and existing uniquely-named consumers are connected.This is a bound property, so clients may also listen for property changes to ReceiveConsumerOperationsInterface.PROPERTY_ALL_CONSUMERS_CONNECTED. If no named consumers have been added, this property is identical to isBeanConnected.
The method name may sound odd, but "is" is the accepted method-name prefix for testing boolean properties.
- Specified by:
isAllConsumersConnectedin interfaceReceiveConsumerOperationsInterface- Returns:
- true if the bean and all the named consumers are connected, false otherwise.
-
removeConsumer
public void removeConsumer(java.lang.String uniqueName) throws EngineExceptionRemove and disconnect an existing uniquely-named consumer. If the consumer is asynchronous, it may still be called after this method has returned; otherwise, the removeConsumer will wait for any calls into the consumer to complete.- Specified by:
removeConsumerin interfaceReceiveConsumerOperationsInterface- Parameters:
uniqueName- the unique-name of an existing consumer.- Throws:
EngineException- if there are problems with removing the consumer.
-
removeAllConsumers
public void removeAllConsumers() throws EngineExceptionDisconnect, Destroy, and Remove all existing consumers. (Assumes a valid connection when doing disconnection logic) If the consumer is asynchronous, it may still be called after this method has returned; otherwise, the removeConsumer will wait for any calls into the consumer to complete.- Specified by:
removeAllConsumersin interfaceReceiveConsumerOperationsInterface- Throws:
EngineException- if there are problems while removing any of the consumers.
-
isDisconnectIfSlowReceiver
public boolean isDisconnectIfSlowReceiver()
Whether any receiver will disconnect if it is slow- Specified by:
isDisconnectIfSlowReceiverin interfaceReceiveConsumerOperationsInterface- Returns:
- true if slow receivers will disconnect
-
-