Advanced Customization > Info*Engine User’s Guide > Task Webject Reference > Web Event Service Webjects > Subscribe-Event
  
Subscribe-Event
DESCRIPTION
Causes the Info*Engine process where this webject is executed to subscribe to listen for a particular event. When an event is caught, Info*Engine builds an execution environment from the request or available data and executes a configured task. When the execution of the webject completes successfully, an empty status group with the status of 0 is returned with a message relaying successful subscription to the event. If the execution of the webject completes unsuccessfully, an appropriate exception is thrown.
SYNTAX
<ie:webject name="Subscribe-Event" type="WES">
  <ie:param name="DBUSER" data="username"/>
  <ie:param name="EVENT" data="event_name"/>
  <ie:param name="EXECUTE_TASK" data="task_name"/>
  <ie:param name="FAILURE_TASK" data="task_name"/>
  <ie:param name="GROUP_IN" data="event_handlers"/>
  <ie:param name="GROUP_OUT" data="results"/>
  <ie:param name="PASSWD" data="password"/>
</ie:webject>
PARAMETERS
Required
Select
Optional
EVENT
DBUSER
EXECUTE_TASK
GROUP_OUT
FAILURE_TASK
PASSWD
GROUP_IN
SERVICE
DBUSER
Specifies the username to use when connecting to the MOM. If this parameter is specified, the parameter value takes precedence over any existing credentials mapping for the authenticated user, or any value specified in the .wes.username and .jms.username properties of the service that is used to connect to the MOM. For more information, see Credentials Mapping for MOMs.
If this parameter is omitted, the mapped credentials for the Web Event Service (WES) are used. If no such mapping is found, then the mapped credentials for the Java Messaging Service (JMS) are used. If neither of these mapped credentials are found, then the value set in the .wes.username property is used. If the .wes.username property is not set, then the value set in the .jms.username property is used. If neither property is set and you do not specify a value for this DBUSER parameter, Info*Engine does not specify a username when connecting to the MOM, and an anonymous connection is attempted.
This parameter is optional.
EVENT
Indicates the LDAP distinguished name of the event for which to listen. The value is an LDAP distinguished name relative to a configured base URI. A syntax of <event_name>@<domain> is recommended to give additional meaning and avoid name conflicts. If relative, the cn= (common name attribute) is implicit if not explicitly specified.
This parameter is required if GROUP_IN is not supplied.
EXECUTE_TASK
Indicates the task to be executed upon event notification. This parameter is required if GROUP_IN is not supplied.
FAILURE_TASK
Indicates the task to be executed if EXECUTE_TASK is not executed. This parameter can only be specified if GROUP_IN is not specified. The default for this parameter is to log the error.
GROUP_IN
Specifies the name of a group from which to extract EVENT, EXECUTE_TASK and FAILURE_TASK. The group must have EVENT and EXECUTE_TASK columns. It can also have a FAILURE_TASK column. A subscription occurs for each row in the input group. This parameter is required if EVENT and EXECUTE_TASK are not specified.
GROUP_OUT
Specifies the name of the status group to be created upon success. The default for this parameter is to create a group named subscription-results. This parameter is optional.
PASSWD
Specifies the password to use when connecting to the MOM. If this parameter is specified, the parameter value takes precedence over existing credentials mapping for the authenticated user, or any value specified in the .wes.password and .jms.password properties of the service that is used to connect to the MOM. For more information see Credentials Mapping for MOMs.
If this parameter is omitted, the mapped credentials for the Web Event Service (WES) are used. If no such mapping is found, then the mapped credentials for the Java Messaging Service (JMS) are used. If neither such mapped credentials are found, then the value set in the .wes.password property is used. If the .wes.password property is not set, then the value set in the .jms.password property is used. If neither property is set and you do not specify a value for this PASSWD parameter, Info*Engine does not specify a password when connecting to the MOM.
This parameter is optional.
SERVICE
Specifies the name of the Info*Engine property set that is configured for connectivity to a specific JMS service. This allows you to configure more than one JMS service per Info*Engine Virtual Machine (VM).
This parameter is optional.
EXAMPLE
The following example subscribes the current Info*Engine process to the specified event:
<%@page language="java" session="false"%>
<%@taglib uri="http://www.ptc.com/infoengine/taglib/core"
                                               prefix="ie"%>

<ie:webject name="Subscribe-Event" type="WES">
  <ie:param name="DBUSER" data="$(@FORM[]dbuser[])"/>
  <ie:param name="PASSWD" data="$(@FORM[]passwd[])"/>
  <ie:param name="EVENT" data="$(@FORM[]event[])"/>
  <ie:param name="GROUP_IN" data="$(@FORM[]group_in[])"/>
  <ie:param name="GROUP_OUT" data="$(@FORM[]group_out[])"/>
</ie:webject>
To actually run this example, you need to provide a form where the DBUSER, PASSWD, EVENT, GROUP_IN, and GROUP_OUT variables are identified.