public class JMSTriggerFacade
extends java.lang.Object
A JMSTriggerFacade object represents an individual JMS trigger on Integration Server.
The JMSTriggerFacade can reference an existing JMS trigger if it is instantiated with the JMSTriggerFacade(String) constructor. When this is done the JMSTriggerFacade can be used to return information about the referenced trigger, update the referenced JMS trigger’s properties, update the referenced trigger’s state (enable/disable/suspend), or it can be used to create a new trigger using the referenced trigger as a starting template.
The JMSTriggerFacade can also be created without any reference to an existing JMS trigger. This is done by instantiating the JMSTriggerFacade with the empty JMSTriggerFacade() constructor. This is only useful when you wish to create a new JMS trigger from scratch.
Constructor and Description |
---|
JMSTriggerFacade()
Instantiates an empty JMSTriggerFacade.
|
JMSTriggerFacade(java.lang.String triggerName)
Instantiates a JMSTriggerFacade object that represents an individual JMS
trigger on Integration Server.
|
Modifier and Type | Method and Description |
---|---|
void |
createTrigger(java.lang.String triggerName,
java.lang.String triggerPackage)
Creates a JMS trigger in the namespace.
|
void |
disableTrigger()
Disables the JMS trigger.
|
void |
enableTrigger()
Enables the JMS trigger if it is currently suspended or disabled.
|
int |
getAcknowledgeMode()
Returns the acknowledgment mode which indicates how or when the session
acknowledges receipt of a message to the JMS provider.
|
java.lang.String |
getAliasName()
Returns the name of the JMS connection alias used by the JMS trigger to
receive messages from the JMS provider.
|
static IData |
getAllAsData()
Get metadata and run-time information for all JMS triggers, including
destinations, routing rules, configured properties, and global throttling
configuration.
|
IData |
getAsData()
Get metadata and run-time information for a single JMS trigger, including
destinations, routing rules, configured properties, and global throttling
configuration.
|
int |
getBatchSize()
Returns the JMS trigger's batch size, which indicates the maximum number
of messages that the associated trigger service can receive at one time.
|
int |
getConsumersCurrentThreadCount()
Returns the number of threads currently receiving and processing messages
for the JMS trigger.
|
java.util.ArrayList<JMSDestinationFilterPair> |
getDestinationFilterPairs()
Gets a java.util.ArrayList of JMSDestnationFilterPair objects that
specify the destinations from which the JMS trigger receives messages and
the message selector the JMS provider uses to filter messages from each
destination.
|
java.lang.String |
getExecuteUser()
Returns the name of the user account whose credentials Integration Server
uses to execute the trigger service associated with the JMS trigger.
|
boolean |
getInDoubtDetection()
Returns a boolean indicating whether duplicate detection is enabled for
persistent messages received by the JMS trigger.
|
long |
getJoinTimeout()
Returns the length of the join time out value (measured in milliseconds)
for the JMS trigger
|
int |
getJoinType()
Returns the type of join for the JMS trigger.
|
java.lang.Throwable |
getLastError()
Returns the last error thrown while executing the JMS trigger.
|
int |
getMaxConcurrentThreads()
Returns the maximum number of server threads that can process messages
for this JMS trigger at one time.
|
int |
getMaxDeliveryAttempts()
Returns the maximum number of retry attempts Integration Server will make
for a trigger service invoked by this JMS trigger.
|
int |
getPrefetchSize()
Deprecated.
No replacement. webMethods Broker is deprecated,
which results in the deprecation of this method.
|
long |
getRedeliveryDelay()
Returns the number of milliseconds Integration Server waits between
attempts to retry a trigger service for this JMS trigger.
|
int |
getRedeliveryFailureAction()
Returns an int that indicates what action Integration Server takes when
retry failure occurs for a non-transacted JMS trigger or a transient
error occurs for a transacted JMS trigger.
|
long |
getResolutionHistoryTTL()
Returns a long specifying the number of milliseconds the document history
database maintains an entry for a message processed by this trigger.
|
NSName |
getResolverServiceName()
Returns the name of the document resolver service for the JMS trigger.
|
boolean |
getResolveWithHistory()
Returns a boolean indicating whether a document history database is used
as part of duplicate detection.
|
NSName |
getResourceMonitoringSvcName()
Returns the name of the resource monitoring service for the JMS trigger.
|
java.util.ArrayList<JMSRoutingRule> |
getRoutingRules()
Gets a java.util.ArrayList of JMSRoutingRule objects that specify the
routing rules for messages received by a JMS trigger.
|
static java.lang.String[] |
getSortedJMSTriggerNames()
Returns a list of JMS triggers on Integration Server.
|
int |
getState()
Returns an int specifying the state of a JMS trigger.
|
boolean |
getSuspendOnError()
Returns a boolean indicating whether Integration Server suspends a JMS
trigger automatically if a fatal error occurs during trigger service
execution.
|
int |
getTotalThrottledThreads()
Returns the current number of server threads that can be used to process
JMS triggers as determined by the Thread Pool Throttle.
|
java.lang.String |
getTriggerName()
Returns the fully qualified name of the referenced JMS trigger.
|
boolean |
isConcurrent()
Returns a boolean that indicates the message processing mode used by the
JMS trigger.
|
boolean |
isEnabled()
Returns a boolean indicating whether or not the JMS trigger is enabled.
|
void |
resumeTrigger()
Enables a JMS trigger that is currently suspended.
|
void |
setAcknowledgmentMode(int acknowledgeMode)
Sets the acknowledgement mode for a JMS trigger, which indicates how
Integration Server acknowledges messages received on behalf of a JMS
trigger.
|
void |
setAliasName(java.lang.String aliasName)
Sets the name of the JMS connection alias that the JMS trigger uses to
connect to the JMS provider.
|
void |
setBatchSize(int batchSize)
Sets the maximum batch size for a JMS trigger.
|
void |
setConcurrent(boolean flag)
Sets the message processing of a JMS trigger to serial or concurrent
processing.
|
void |
setDestinationFilterPairs(java.util.ArrayList<JMSDestinationFilterPair> pairs)
Specifies the destinations from which the JMS trigger receives messages
and the message selector the JMS provider uses to filter messages from
each destination.
|
void |
setEnabled(boolean enabled)
Enables or disables the JMS trigger.
|
void |
setExecuteUser(java.lang.String executeUser)
Sets the execution user for a JMS trigger.
|
void |
setInDoubtDetection(boolean flag)
Enables or disables duplicate detection for the JMS trigger.
|
void |
setJoinTimeout(long timeout)
Sets the length of the join time-out.
|
void |
setJoinType(int joinType)
Sets the join type for a JMS trigger.
|
void |
setMaxConcurrentThreads(int maxConcurrent)
Sets the maximum number of messages that Integration Server can process
concurrently for this JMS trigger.
|
void |
setMaxDeliveryAttempts(int maxRedeliveryAttempts)
Sets the maximum number of attempts Integration Server makes to
re-execute a trigger service if the trigger service failed because of a
transient error.
|
void |
setPrefetchSize(int prefetchSize)
Sets the maximum number of messages that Integration Server retrieves for
this JMS trigger at one time from the webMethods Broker.
|
void |
setRedeliveryDelay(long redeliveryDelay)
Sets the time interval Integration Server waits between retry attempts
for a trigger service that failed because of a transient error.
|
void |
setRedeliveryFailureAction(int redeliveryFailureAction)
Determines what action Integration Server takes when retry failure occurs
for a non-transacted JMS trigger or a transient error occurs for a
transacted JMS trigger.
|
void |
setResolutionHistoryTTL(long ttl)
Sets the length of time the document history database maintains an entry
for a message processed by this trigger.
|
void |
setResolverServiceName(NSName name)
Sets the name of the document resolver service for the JMS trigger.
|
void |
setResolveWithHistory(boolean flag)
Determines whether a document history database is used as part of
duplicate detection.
|
void |
setResourceMonitoringSvcName(NSName resourceMonitoringSvcName)
Sets the resource monitoring service for the JMS trigger.
|
void |
setRoutingRules(java.util.ArrayList<JMSRoutingRule> rules)
Specifies the routing rules for the messages received by the JMS trigger.
|
void |
setSuspendOnError(boolean flag)
Sets a flag indicating whether the JMS trigger suspends automatically
when a fatal exception occurs during trigger service execution.
|
void |
suspendTrigger()
Suspends the JMS trigger.
|
void |
updateTrigger()
Updates the JMS trigger you indicated in the constructor with the changes
you made by calling the setter methods.
|
public JMSTriggerFacade(java.lang.String triggerName) throws JMSSubsystemException
triggerName
- the String representing the fully qualified name of the JMS
trigger for which you want to initialize a JMSTriggerFacade
objectJMSSubsystemException
- if the required triggerName parameter is not provided or if
triggerName specifies a JMS trigger that does not existpublic JMSTriggerFacade()
Note: All getter methods will return null, false, or zero (0) if JMSTriggerFacade is instantiated with this constructor.
public java.lang.String getTriggerName()
public int getAcknowledgeMode()
public java.lang.String getAliasName()
public int getBatchSize()
Batch processing can be an effective way of handling a high volume of small messages for the purposes of persisting them or delivering them to another back-end resource. For example, you might want to take a batch of messages, create a packet of SAP IDocs, and send the packet to SAP with a single call. Alternatively, you might want to insert multiple messages into a database at one time using only one insert. The trigger service processes the messages as a unit as opposed to in a series.
Integration Server acknowledges all the messages received in a batch from the JMS provider at one time.
public boolean isConcurrent()
public int getConsumersCurrentThreadCount()
Serial JMS triggers have one consumer and will use one thread from the server thread pool to receive and process a message.
Concurrent JMS triggers use a pool of consumers to receive and process messages. Each consumer uses one thread from the server thread pool to receive and process a message. For a concurrent JMS trigger, Integration Server also dedicates a thread to managing the pool of consumers. Consequently, the maximum number of threads that can be used by a JMS trigger is equal to the Max execution threads value plus 1. For example, a concurrent JMS trigger configured to process up to 10 messages at a time can use a maximum of 11 server threads.
public boolean isEnabled()
getState()
.getState()
public java.lang.String getExecuteUser()
public java.util.ArrayList<JMSDestinationFilterPair> getDestinationFilterPairs()
public boolean getInDoubtDetection()
public long getJoinTimeout()
public int getJoinType()
public java.lang.Throwable getLastError()
public int getMaxConcurrentThreads()
Serial JMS triggers use one thread at a time pool to receive and process a message.
Concurrent JMS triggers can use multiple server threads to receive and process messages at one time.
public int getMaxDeliveryAttempts()
Transient error handling, including specifying retry attempts, can be configured for non-transacted JMS triggers only.
JMSTriggerFacade.setMaxDeliveryAttempts
public int getPrefetchSize()
Note: This method is only applicable when retrieving messages from the webMethods Broker.
Use the setPrefetchSize(int)
method to change the prefetch
value for a specific JMS trigger.
setPrefetchSize(int)
public long getRedeliveryDelay()
public int getRedeliveryFailureAction()
For a non-transacted JMS trigger, Integration Server can do one of the following
For a transacted JMS trigger, Integration Server can do one of the following:
public long getResolutionHistoryTTL()
public NSName getResolverServiceName()
public boolean getResolveWithHistory()
The document history database maintains a history of the persistent messages processed by JMS triggers. Integration Server adds an entry to the document history database when a trigger service begins executing and when it executes to completion (whether it ends in success or failure). The document history database contains message processing information only for triggers for which the Use history property is set to true.
public NSName getResourceMonitoringSvcName()
public java.util.ArrayList<JMSRoutingRule> getRoutingRules()
public boolean getSuspendOnError()
public int getState()
public int getTotalThrottledThreads()
public void setAcknowledgmentMode(int acknowledgeMode)
AUTO_ACKNOWLEDGE Automatically acknowledges the message when it is received by the JMS trigger. Integration Server will acknowledge the message before the trigger completes processing. The JMS provider cannot redeliver the message if Integration Server becomes unavailable before message processing completes.
CLIENT_ACKNOWLEDGE Acknowledges or recovers the message only after the JMS trigger processes the message completely.
DUPS_OK_ACKNOWLEDGE Lazily acknowledges the delivery of messages. This may result in the delivery of duplicate messages.
acknowledgeMode
- an int representing the acknowledgement mode; AUTO_ACKNOWLEDGE =
1; CLIENT_ACKNOWLEDGE = 2; DUPS_OK_ACKNOWLEDGE = 3public void setAliasName(java.lang.String aliasName)
aliasName
- a String for the JMS connection aliaspublic void setBatchSize(int batchSize)
When setting batch processing, keep the following in mind:
The trigger service must be coded to handle multiple messages as input. That is, the trigger service must use the pub.jms.batchTriggerSpec as the service signature.
When receiving a batch of messages, Integration Server evaluates the local filter in the routing rule against the first message in the batch only.
The JMS trigger must not be part of a transaction. The JMS connection alias specified by the trigger must have a transaction type of NO TRANSACTION.
A JMS trigger that contains an All (AND) or Only one (XOR) join cannot use batch processing.
batchSize
- an int for the batch size for the JMS trigger. If you do not
want Integration Server to perform batch processing for this
JMS trigger, specify 1. If this JMS trigger uses a transacted
JMS connection alias, the batchSize
must be set
to 1.public void setConcurrent(boolean flag)
flag
- a boolean indicating whether the JMS trigger processes
messages concurrently or serially. Specify true for concurrent
processing; false for serial processing.public void setDestinationFilterPairs(java.util.ArrayList<JMSDestinationFilterPair> pairs)
The message selector must use the message selector syntax specified in the Java Message Service, Version 1.1. The message selector can reference header and property fields in the JMS message only.
pairs
- a java.util.ArrayList of JMSDetinationFilterPair objects that
specify the destinations from which the JMS trigger receives
messages and the message selector that the JMS provider uses
to limit the messages received by the JMS trigger.public void setEnabled(boolean enabled)
enabled
- a boolean for enabling or disabling the JMS trigger. Specify
true to enable; false to disablepublic void setExecuteUser(java.lang.String executeUser)
executeUser
- a String for the name of the user account whose credentials
Integration Server uses to execute a service associated with
the JMS trigger. You can specify a locally defined user
account or a user account defined in a central or external
directory.public void setInDoubtDetection(boolean flag)
flag
- a boolean to enable or disable duplicate detection. Set to
true to enable; false to disable.public void setJoinTimeout(long timeout)
A join time-out only applies when the JMS trigger receives messages from multiple destinations and specifies an And (ALL) or Only one (XOR) join type. A join time-out for an All (AND) join specifies how long Integration Server waits for messages from all of the destinations specified in the join. A join time-out for an Only one (XOR) join specifies how long Integration Server discards instances of the other messages received from the specified destinations.
timeout
- a long indicating the length of the join time-out measured in
seconds. Set to -1 if you do not want the join to expire.public void setJoinType(int joinType)
joinType
- an int to specify the join type for a JMS trigger that
receives messages from multiple destinations; AND = 1; XOR =
2; OR = 3. The default is 3.public void setMaxConcurrentThreads(int maxConcurrent)
maxConcurrent
- an int for the maximum number of messages that Integration
Server can process at one time for this concurrent JMS triggerpublic void setMaxDeliveryAttempts(int maxRedeliveryAttempts)
maxRedeliveryAttempts
- an int indicating the maximum number of times Integration
Server should attempt to re-execute the trigger service. Set
to 0 if you do not want Integration Server to retry the
trigger service.public void setPrefetchSize(int prefetchSize)
Note: This method is only applicable when retrieving messages from the webMethods Broker.
prefetchSize
- an int for the maximum number of messages Integration Server
fetches for this JMS trigger from the JMS provider at one
time. The prefetchSize
must be greater than 0.
Set to -1 to use the value of
watt.server.jms.trigger.maxPrefetchSize as the prefetch size.public void setRedeliveryDelay(long redeliveryDelay)
redeliveryDelay
- a long specifying the number of milliseconds Integration
Server waits before retrying a trigger service that failed
because of a transient error (ISRuntimException).public void setRedeliveryFailureAction(int redeliveryFailureAction)
For a non-transacted JMS trigger, Integration Server can do one of the following:
For a transacted JMS trigger, Integration Server can do one of the following:
redeliveryFailureAction
- an int indicating how Integration Server responds when retry
failure occurs for a trigger service executed by this JMS
trigger. For a non-transacted JMS trigger, Throw Exception =
0; Suspend and Retry Later = 1. For a transacted JMS trigger,
Recover Only = 0; Suspend and Recover = 1.public void setResolutionHistoryTTL(long ttl)
ttl
- a long specifying the number of milliseconds for which the
document history database maintains an entry for a message
processed by this JMS triggersetResolveWithHistory(boolean)
public void setResolverServiceName(NSName name)
name
- an NSName object specifying the namespace name of the
document resolver servicepublic void setResolveWithHistory(boolean flag)
The document history database maintains a history of the persistent messages processed by JMS triggers. Integration Server adds an entry to the document history database when a trigger service begins executing and when it executes to completion (whether it ends in success or failure). The document history database contains message processing information only for triggers for which the Use history property is set to true.
flag
- A boolean indicating whether a document history database is
used. True if one is used; otherwise false.public void setResourceMonitoringSvcName(NSName resourceMonitoringSvcName)
resourceMonitoringSvcName
- an NSName object specifying the namespace name of resource
monitoring servicepublic void setRoutingRules(java.util.ArrayList<JMSRoutingRule> rules)
If a JMS trigger contains multiple routing rules to support ordered service execution, you can use local filters to process a series of messages in a particular order.
When creating a local filter, you can exclude the JMSMessage document from the filter even though it is part of the pipeline provided to the JMS trigger service.
rules
- a java.util.ArrayList of JMSRoutingRule objects that specify
trigger service and local filter for each routing rule.public void setSuspendOnError(boolean flag)
flag
- a boolean that specifies whether Integration Server suspends
the JMS trigger when the trigger service ends because of a
fatal exception. Set to true to suspend; otherwise false.public void updateTrigger() throws JMSSubsystemException
createTrigger(String, String)
method to create the JMS trigger with the properties specified in the
setter methods.
Note: Calling a setter method will have no impact on a JMS trigger until
the updateTrigger() method is called.JMSSubsystemException
- if the empty JMSTriggerFacade() constructor was used to
create the JMSTriggerFacade object.createTrigger(String, String)
public void createTrigger(java.lang.String triggerName, java.lang.String triggerPackage) throws JMSSubsystemException
triggerName
- a String specifying the folder and name of the JMS trigger.
Separate folder names using a period; separate the node name
using a colon. For example, folder.subfolder:JMSTriggerNametriggerPackage
- a String for the name of the package in which you want to
place the new JMS TriggerJMSSubsystemException
- if the triggerName and/or triggerPackage values are not
provided; if the specified triggerPackage does not exist; if
a trigger with the specified triggerName already exists; if
the triggerName contains a restricted character; if the user
creating the JMS trigger does not have sufficient permissions
to create namespace elements;public void suspendTrigger() throws java.lang.Exception
java.lang.Exception
- if an exception occurspublic void resumeTrigger() throws java.lang.Exception
When a JMS trigger is enabled, it is running and connected to the JMS provider. Integration Server retrieves and processes messages for the JMS trigger.
java.lang.Exception
- if an exception occursenableTrigger()
public void disableTrigger() throws java.lang.Exception
java.lang.Exception
- if an exception occursenableTrigger()
public void enableTrigger() throws java.lang.Exception
java.lang.Exception
- if an exception occurspublic static java.lang.String[] getSortedJMSTriggerNames()
public static IData getAllAsData() throws JMSSubsystemException
JMSSubsystemException
public IData getAsData()