JBoss.orgCommunity Documentation

Chapter 3. Configurating and Using JBCP Remote SLEE Connection Tool

3.1. Configuring JBCP Remote SLEE Connection Tool
3.2. Using JBCP Remote SLEE Connection Tool

The only configuration needed is setting up the address of the JAIN SLEE container to interact, this is done through the config-property named SleeJndiName inside slee-ds.xml file inside the rar archive or directory. ${jboss.bind.address} should be replaced with the hostname used by the JAIN SLEE container.

The tool installs the SLEE Connection Factory in JNDI, below is example code which retrieves it and uses it to fire an event into the JAIN SLEE container.



            
    // retrieves JNDI context
    InitialContext context = new InitialContext();
    
    // retrieves the connection factory from JNDI
    SleeConnectionFactory factory = (SleeConnectionFactory) context.lookup("java:/MobicentsConnectionFactory");
    
    // creates a connection to the SLEE container
    SleeConnection connection = factory.getConnection();
    // creates the activity handle which will be used to fire the event 
    ExternalActivityHandle handle = connection.createActivityHandle();
    // retrieves the event type ID
    EventTypeID eventTypeID = connection.getEventTypeID("CustomEvent", "...", "1.0");
    
    // creates the event object
    CustomEvent eventObject = new CustomEvent();
    
    // fires the event in the remote SLEE container
    connection.fireEvent(eventObject, eventTypeID, handle, null);
    // closes the connection
    connection.close();