You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by elliottjf <jf...@pobox.com> on 2007/02/02 09:40:51 UTC

How can I configure an "Exclusive Consumer" queue with a Jencks JCAConnector?

I'm attempting to create a Jencks JCAConnector around a
"consumer.exclusive=true" marked queue, but the constructed consumer appears
to not be exclusive.

Has anybody attempted a similar use case or know why this shouldn't work?

I'm using Spring 2.0.2, ActiveMQ 4.1, and Jencks 2.0

Here are the relevant snippits from my Spring appContext.xml

    <bean id="rpcInboundConnector" class="org.jencks.JCAConnector">
        <property name="jcaContainer" ref="jencks"/>
        <property name="activationSpec">
            <bean class="org.apache.activemq.ra.ActiveMQActivationSpec">
                <property name="destination"
value="rpc-exclusive?consumer.exclusive=true"/>
                <property name="destinationType" value="javax.jms.Queue"/>
            </bean>
        </property>
        <property name="ref" value="rpcMqListener"/>
    </bean>

    <bean id="jencks" class="org.jencks.JCAContainer">
        <property name="transactionManager" ref="transactionManager"/>
        <property name="threadPoolSize" value="25"/>
        <property name="resourceAdapter">
            <bean id="activeMQResourceAdapter"
class="org.apache.activemq.ra.ActiveMQResourceAdapter">
                <property name="serverUrl" value="tcp://lokum:61616"/>
            </bean>
        </property>
    </bean>

    <bean id="transactionManager"
class="org.jencks.factory.TransactionManagerFactoryBean"/>


Any pointers in the right direction would be much appreciated!
cheers,
 - joe


-- 
View this message in context: http://www.nabble.com/How-can-I-configure-an-%22Exclusive-Consumer%22-queue-with-a-Jencks-JCAConnector--tf3159712.html#a8763535
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: ActiveMQConnection.createConnectionConsumer bug?

Posted by Rob Davies <ra...@gmail.com>.
Good catch! - committed to trunk  SVN revision 504023

On 6 Feb 2007, at 02:33, elliottjf wrote:

>
> can somebody confirm if this is really a bug?  if it is, it looks  
> like a
> pretty serious one.
>
>
> elliottjf wrote:
>>
>> Okay, from what I can tell, when using the ra activation spec driven
>> consumer construction, the ConsumerInfo options where getting lost.
>>
>> Upon removing the errant 'this.' and rebuilding the activemq-core  
>> module,
>> things are now working for me.
>>
>> snippet from org.apache.activemq.ActiveMQConnection.java:
>>
>>     public ConnectionConsumer createConnectionConsumer(Destination
>> destination, String messageSelector, ServerSessionPool  
>> sessionPool, int
>> maxMessages, boolean noLocal) throws JMSException {
>>
>>         checkClosedOrFailed();
>>         ensureConnectionInfoSent();
>>
>>         ConsumerId consumerId = createConsumerId();
>>         ConsumerInfo info = new ConsumerInfo(consumerId);
>>
>> info.setDestination 
>> (ActiveMQMessageTransformation.transformDestination(destination));
>>         info.setSelector(messageSelector);
>>         info.setPrefetchSize(maxMessages);
>>         info.setNoLocal(noLocal);
>>         info.setDispatchAsync(dispatchAsync);
>>
>>         // Allows the options on the destination to configure the
>> consumerInfo
>>         if( info.getDestination().getOptions()!=null ) {
>>             HashMap options = new
>> HashMap(info.getDestination().getOptions());
>> //            IntrospectionSupport.setProperties(-->this.info<--,  
>> options,
>> "consumer.");
>> //JE 07.02.01 removed the 'this' from info.  seems to fix the  
>> honoring of
>> consumer.exclusive option for a jencks jcaconnectior managed consumer
>>             IntrospectionSupport.setProperties(info, options,
>> "consumer.");
>>         }
>>
>>         return new ActiveMQConnectionConsumer(this, sessionPool,  
>> info);
>>     }
>>
>>
>
> -- 
> View this message in context: http://www.nabble.com/How-can-I- 
> configure-an-%22Exclusive-Consumer%22-queue-with-a-Jencks- 
> JCAConnector--tf3159712.html#a8819449
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>


Re: ActiveMQConnection.createConnectionConsumer bug?

Posted by elliottjf <jf...@pobox.com>.
can somebody confirm if this is really a bug?  if it is, it looks like a
pretty serious one.


elliottjf wrote:
> 
> Okay, from what I can tell, when using the ra activation spec driven
> consumer construction, the ConsumerInfo options where getting lost.
> 
> Upon removing the errant 'this.' and rebuilding the activemq-core module,
> things are now working for me.
> 
> snippet from org.apache.activemq.ActiveMQConnection.java:
> 
>     public ConnectionConsumer createConnectionConsumer(Destination
> destination, String messageSelector, ServerSessionPool sessionPool, int
> maxMessages, boolean noLocal) throws JMSException {
>         
>         checkClosedOrFailed();
>         ensureConnectionInfoSent();
>         
>         ConsumerId consumerId = createConsumerId();
>         ConsumerInfo info = new ConsumerInfo(consumerId);
>        
> info.setDestination(ActiveMQMessageTransformation.transformDestination(destination));
>         info.setSelector(messageSelector);
>         info.setPrefetchSize(maxMessages);
>         info.setNoLocal(noLocal);
>         info.setDispatchAsync(dispatchAsync);
>         
>         // Allows the options on the destination to configure the
> consumerInfo
>         if( info.getDestination().getOptions()!=null ) {
>             HashMap options = new
> HashMap(info.getDestination().getOptions());
> //            IntrospectionSupport.setProperties(-->this.info<--, options,
> "consumer.");
> //JE 07.02.01 removed the 'this' from info.  seems to fix the honoring of
> consumer.exclusive option for a jencks jcaconnectior managed consumer
>             IntrospectionSupport.setProperties(info, options,
> "consumer.");
>         }
>         
>         return new ActiveMQConnectionConsumer(this, sessionPool, info);
>     }
> 
> 

-- 
View this message in context: http://www.nabble.com/How-can-I-configure-an-%22Exclusive-Consumer%22-queue-with-a-Jencks-JCAConnector--tf3159712.html#a8819449
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


ActiveMQConnection.createConnectionConsumer bug?

Posted by elliottjf <jf...@pobox.com>.
Okay, from what I can tell, when using the ra activation spec driven consumer
construction, the ConsumerInfo options where getting lost.

Upon removing the errant 'this.' and rebuilding the activemq-core module,
things are now working for me.

snippet from org.apache.activemq.ActiveMQConnection.java:

    public ConnectionConsumer createConnectionConsumer(Destination
destination, String messageSelector, ServerSessionPool sessionPool, int
maxMessages, boolean noLocal) throws JMSException {
        
        checkClosedOrFailed();
        ensureConnectionInfoSent();
        
        ConsumerId consumerId = createConsumerId();
        ConsumerInfo info = new ConsumerInfo(consumerId);
       
info.setDestination(ActiveMQMessageTransformation.transformDestination(destination));
        info.setSelector(messageSelector);
        info.setPrefetchSize(maxMessages);
        info.setNoLocal(noLocal);
        info.setDispatchAsync(dispatchAsync);
        
        // Allows the options on the destination to configure the
consumerInfo
        if( info.getDestination().getOptions()!=null ) {
            HashMap options = new
HashMap(info.getDestination().getOptions());
//            IntrospectionSupport.setProperties(-->this.info<--, options,
"consumer.");
//JE 07.02.01 removed the 'this' from info.  seems to fix the honoring of
consumer.exclusive option for a jencks jcaconnectior managed consumer
            IntrospectionSupport.setProperties(info, options, "consumer.");
        }
        
        return new ActiveMQConnectionConsumer(this, sessionPool, info);
    }

-- 
View this message in context: http://www.nabble.com/How-can-I-configure-an-%22Exclusive-Consumer%22-queue-with-a-Jencks-JCAConnector--tf3159712.html#a8770428
Sent from the ActiveMQ - User mailing list archive at Nabble.com.