Create an inbound JMS integration

PolicyCenter uses inbound JMS integration to read information from messages that an external system creates. This integration can be either a message reply plugin or a startable plugin.

The base configuration of PolicyCenter provides implementations for the message reply plugin and the startable plugin for inbound file integration. You can use these plugins as a template for your own plugin. PolicyCenter also provides implementations for the message reply handler plugin and the startable handler plugin for inbound JMS integration. You can use these plugins as a template for your own handler plugin. You provide the handler class that implements your business logic.

Procedure

  1. In the Project window, navigate to configuration > config > integration, and then open the inbound-integration-config.xml file.
  2. Configure the thread pools.
    You can use a thread pool element in the base configuration as a template.
  3. In the list of integrations, create one <integration> element of type <jms-integration>.
    You can use a <jms-integration> element in the base configuration as a template.
  4. Set configuration parameter subelements, ensuring that the order of subelements is correct.
    The inbound-integration-config.xsd file specifies the correct sequence of the subelements.
    1. Set values for JNDI properties in the <jndi-properties> subelement and its <jndi-property> subelements.
      Typically, you set values for the naming factory, connection factory, and queue name for your JMS configurations.
      The following lines show an example configuration for an Apache Artemis broker.
      <jndi-properties>
        <jndi-property> 
          <key>java.naming.factory.initial</key> 
          <value>org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory</value>
        </jndi-property>
        <jndi-property>
          <key>connectionFactory.ConnectionFactory</key>
          <value>tcp://localhost:61616</value>
        </jndi-property>
        <jndi-property>
          <key>queue.MyQueue</key>
          <value>MyQueue</value>
        </jndi-property>
      </jndi-properties>
    2. Set values for <connectionfactoryjndi> and <destinationjndi> subelements.
      These values must match the JNDI property values for the connection factory and queue name.
      For the example JNDI properties, these elements look like the following lines.
      <connectionfactoryjndi>ConnectionFactory</connectionfactoryjndi>
      <destinationjndi>MyQueue</destinationjndi>
  5. Create the inbound JMS integration plugin.
    1. In Studio, in the Plugins registry, add a new .gwp file.
    2. Studio prompts for a plugin name and plugin interface. For the plugin name, use a name that represents the purpose of this specific inbound integration. For the Interface field, enter one of the following values.
      • For a message reply plugin, type InboundIntegrationMessageReply.
      • For a startable plugin for non-messaging use, type InboundIntegrationStartablePlugin.
    3. Click the plus (+) symbol to add a plugin implementation and choose Add Java plugin.
    4. In the Java class field, enter one of the following plugin types.
      • For a message reply plugin, type com.guidewire.pl.integration.inbound.jms.DefaultJMSInboundIntegrationMessageReply.
      • For a startable plugin for non-messaging use, type com.guidewire.pl.integration.inbound.jms.DefaultJMSInboundIntegrationPlugin.
    5. Add a plugin parameter with the key integrationservice. For the value, type the unique name for your integration that you used in inbound-integration-config.xml for this integration.
  6. Write your own inbound integration handler plugin implementation.
    • For a message reply plugin, implement the interface gw.plugin.integration.inbound.InboundIntegrationMessageReplyHandler.
    • For a startable plugin for non-messaging use, implement the interface gw.plugin.integration.inbound.InboundIntegrationHandlerPlugin.
    Both interfaces have one method called process, which has a single argument of type Object. The method has no return value. The JMS integration calls that method to process one message. Downcast this Object to javax.jms.Message before using it.
  7. Create the inbound JMS integration handler plugin to register your handler plugin implementation class.
    1. In Studio, in the Plugins registry, add a new .gwp file.
    2. Set the interface name to the handler interface that you implemented.
      The Name field must match the <pluginhandler> subelement in the inbound-integration-config.xml file for this integration.
    3. Click the plus (+) symbol to add a plugin implementation and choose the type of class that you implemented.
    4. In the class name field, type or navigate to the class that you implemented.
  8. Start the server in Guidewire Studio and test your new inbound integration by sending one or more JMS messages to the queue that your class handles.

What to do next

See also