The TopicListener component receives messages from a JMS (Java Message Service) service. The TopiListener component must be used as the listener component of a Global Automatic.
The TopicListener component takes the following parameters for initialization:
| Parameter | Required? | Description |
|---|---|---|
| contextFactory | Yes | Class name of the JNDI context factory that is used to locate Topic and the TopicConnectionFactory |
| providerURL | Yes | Base URL of the naming service |
| securityPrincipal | No | Security principal that authenticates against the naming service (for example, username) |
| securityCredentials | No | Credentials required to authenticate against the naming service (for example, password) |
| factoryName | Yes | JNDI name of the TopicConnectionFactory |
| topicName | Yes | JNDI name of the Topic |
| jmsUsername | No | Username that authenticates with the JMS provider |
| jmsPassword | No | Password that authenticates with the JMS provider |
| transacted | No | Specifies whether the session will be transacted |
The code below uses the parameters described in the table to connect to a topic found in an LDAP server. In the example, componentArguments is a predefined variable where initialization parameters are passed to the component:
componentArguments = [ "contextFactory" : "com.sun.jndi.ldap.LdapCtxFactory", "providerURL" : "ldap://gollum:30112/o=cs,c=us", "securityPrincipal": "cn=root", "securityCredentials": "password", "factoryName" : "cn=myTCF", "topicName" : "cn=myTopic", "jmsUsername" : "juancn", "jmsPassword" : "mypasswd", "transacted" : "false" ]