Programmatically configuring the Eclipse Amlen resource adapter for inbound communication

You can set activation specification properties programmatically in Message-Driven beans (MDBs) or by configuring the properties of an ActivationSpec object.

The configuration values that are provided in an MDB can set or override the properties of an ActivationSpec object. At least three properties must be set for an Eclipse Amlen MDB application. Other required settings have default values that work if Eclipse Amlen is configured appropriately. The following information lists the properties that must be set:

  • The properties that describe the destination. You must set either destination and destinationType or destinationLookup.
  • The properties that allow an application to connect to Eclipse Amlen. You must set server and port. The server property can be set to the Eclipse Amlen host name or names, or to the Eclipse Amlen IP address or IP addresses. The port property can be set to the Eclipse Amlen port.

Other property settings might be required depending on your Eclipse Amlen configuration. For example, if secure connections are required then the protocol property must be set to tcps.

The following sample code shows the minimal configuration that is required in an MDB to allow an application to connect to Eclipse Amlen:

/**
* Message-Driven Bean implementation class for: SampleBean
*/
@MessageDriven(
   activationConfig = {
       @ActivationConfigProperty(
           propertyName = "destinationType", propertyValue = "javax.jms.Topic"),
       @ActivationConfigProperty(
           propertyName = "destination", propertyValue = "myTopic"),
       @ActivationConfigProperty(
           propertyName = "server", propertyValue = "192.168.161.11"),
       @ActivationConfigProperty(
           propertyName = "port", propertyValue = "16102")
   })

public class SampleBean implements MessageListener {
   /**
    * @see MessageListener#onMessage(Message)
    */
   public void onMessage(Message message) {
       .
       .
       .
   }

You can set any activation specification properties in an MDB. The application developer and application deployer need to decide whether to set these properties directly in the MDB or at deployment time.

For more information about setting values in an ActivationSpec object, see Configuring the Eclipse Amlen resource adapter for inbound communication.