synchronized protected void addMessagingEngine ( final JsMessagingEngine messagingEngine ) { final String methodName = "addMessagingEngine" ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , methodName , messagingEngine ) ; } SibRaMessagingEngineConnection connection = null ; try { /* * Get a connection for the messaging engine */ connection = getConnection ( messagingEngine ) ; final SICoreConnection coreConnection = connection . getConnection ( ) ; if ( coreConnection instanceof SICoreConnection ) { /* * Create destination listener */ final DestinationListener destinationListener = new SibRaDestinationListener ( connection , _messageEndpointFactory ) ; /* * Determine destination type */ final DestinationType destinationType = _endpointConfiguration . getDestinationType ( ) ; /* * Register destination listener */ final SIDestinationAddress [ ] destinations = coreConnection . addDestinationListener ( null , destinationListener , destinationType , DestinationAvailability . RECEIVE ) ; /* * Create a listener for each destination ... */ for ( int j = 0 ; j < destinations . length ; j ++ ) { try { connection . createListener ( destinations [ j ] , _messageEndpointFactory ) ; } catch ( final ResourceException exception ) { FFDCFilter . processException ( exception , CLASS_NAME + "." + methodName , FFDC_PROBE_1 , this ) ; SibTr . error ( TRACE , "CREATE_LISTENER_FAILED_CWSIV0803" , new Object [ ] { exception , destinations [ j ] . getDestinationName ( ) , messagingEngine . getName ( ) , messagingEngine . getBusName ( ) } ) ; } } } } catch ( final SIException exception ) { FFDCFilter . processException ( exception , CLASS_NAME + "." + methodName , FFDC_PROBE_2 , this ) ; SibTr . error ( TRACE , "ADD_DESTINATION_LISTENER_FAILED_CWSIV0804" , new Object [ ] { exception , messagingEngine . getName ( ) , messagingEngine . getBusName ( ) } ) ; closeConnection ( messagingEngine ) ; } catch ( final ResourceException exception ) { FFDCFilter . processException ( exception , CLASS_NAME + "." + methodName , FFDC_PROBE_3 , this ) ; SibTr . error ( TRACE , "CREATE_CONNECTION_FAILED_CWSIV0801" , new Object [ ] { exception , messagingEngine . getName ( ) , messagingEngine . getBusName ( ) } ) ; closeConnection ( messagingEngine ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , methodName ) ; } }
Connects to the given messaging engine . Registers a destination listener and creates listeners for each of the current destinations .