public void subscribe ( String name , Listener listener , Map headers ) { synchronized ( _listeners ) { if ( listener != null ) { List list = ( List ) _listeners . get ( name ) ; if ( list == null ) { list = new ArrayList ( ) ; _listeners . put ( name , list ) ; } if ( ! list . contains ( listener ) ) list . add ( listener ) ; } } if ( headers == null ) headers = new HashMap ( ) ; headers . put ( "destination" , name ) ; transmit ( Command . SUBSCRIBE , headers ) ; }
Subscribe to a channel .