Version 13

    Receivers Implementation


    The receivers implementation used by Queues to record who is waiting for a message

    (and in which order they should be processed) is pluggable. You just need to implement







      - the default implementation using a




      - implemented with an




      - implemented with n






    • You specify it as an attribute on the DestinationManager, Queue or Topic (

      e.g.: <attribute name= "ReceiversImpl"></attribute>


    • If the destination has no configuration it uses the Destination Manager config.

    • If the destination manager has no configuration it uses the default.




    • The default implementation is there for backwards compatibility.

    • It has been reported that the


      implementations provide better load balancing when there are competing receivers. Neither


      implementation has been as thoroughly tested as the



    • The default implementation will only use other nodes if its own load is too high. Either of the List-based implementations can be used to get "round-robin" (perhaps "fair queueing" is a better term) distribution.

    • The Topic configuration is largely irrelevent since only one receiver can be listening on a subscription, but it is anticipated that something more performant than a


      of 1 could be implemented.

    • The receivers implementation should have "Set" semantics, i.e. if the subscription is already present it shouldn't add it twice.




    <mbean code="" name="">
        <depends optional-attribute-name="MessageCache"></depends>
        <depends optional-attribute-name="PersistenceManager"></depends>
        <depends optional-attribute-name="StateManager"></depends>
        <attribute name="ReceiversImpl">



    The Receivers interface

    * JBoss, Home of Professional Open Source
    * Copyright 2005, JBoss Inc., and individual contributors as indicated
    * by the @authors tag. See the copyright.txt in the distribution for a
    * full listing of individual contributors.
    * This is free software; you can redistribute it and/or modify it
    * under the terms of the GNU Lesser General Public License as
    * published by the Free Software Foundation; either version 2.1 of
    * the License, or (at your option) any later version.
    * This software is distributed in the hope that it will be useful,
    * but WITHOUT ANY WARRANTY; without even the implied warranty of
    * Lesser General Public License for more details.
    * You should have received a copy of the GNU Lesser General Public
    * License along with this software; if not, write to the Free
    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
    * 02110-1301 USA, or see the FSF site:
    import java.util.ArrayList;
    import java.util.Iterator;
     * Interface to be implemented by a receivers implementation.
     * The implementation should also have a default constructor.<p>
     * NOTE: There is no need to internally synchronize the caller
     * handles that.<p>
     * NOTE: This datastructure should have Set semantics. 
     *       i.e. attempts to add a subscriber that is already
     *       present should be ignored. Or more explicitly
     *       a subscriber should present zero or once. 
     * @author <a href="">Adrian Brock</a>
     * @version $Revision: 1.4 $
    public interface Receivers
        * @return Get the number of receivers
       int size();
        * @return the subscriptions as an array list, this must be a
        * clone of any internal datastructure
       ArrayList listReceivers();
        * Add a receiver, ignored if the receiver is already present.
        * @param sub the receiver to add
       void add(Subscription sub);
        * Remove a receiver
        * @param sub the receiver to remove
       void remove(Subscription sub);
        * Get an iterator to loop over all receivers
        * @return the iterator
       Iterator iterator();


    For a useful discussion of this subject

    See the JBoss Forums ( -> JBoss User -> Messaging, JMS & JBossMQ) topic JMS Queue residing in a cluster