You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Pesochinskiy, Vadim (MSCIBARRA)" <Va...@mscibarra.com> on 2006/08/10 20:39:02 UTC

Pulling consumer design

James,
 
One way to implement this, which I think will fit with current design is
to introduce a MessagePullCommand, which informs the broker that
consumer is ready to accept next message. When broker get this request
it dispatches one message to this consumer. What do you think about
this?
 
- Vadim
--------------------------------------------------------

NOTICE: If received in error, please destroy and notify sender. Sender does not intend to waive confidentiality or privilege. Use of this email is prohibited when received in error.

Re: Pulling consumer design

Posted by James Strachan <ja...@gmail.com>.
Sorry about that, I'd forgotten to run the mvn gram:gram command. Its now in SVN

On 8/11/06, Vadim Pesochinsky <Va...@mscibarra.com> wrote:
>
> There is a little problem with MessagePullMarshaller not generated / added to
> svn. I tried to run generator, but withouth much luck. Found this
> instructions, but I could not find the maven-gram-plugin. Thanks.
>
> cd maven-gram-plugin/
> mvn install
> cd ../activemq-openwire-generator/
> mvn install
> cd ../activemq-core
> mvn gram:gram
>
>
> javax.jms.JMSException: Unknown data type: 20
>         at
> org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:58)
>         at
> org.apache.activemq.ActiveMQConnection.asyncSendPacket(ActiveMQConnection.java:1130)
>         at
> org.apache.activemq.ActiveMQSession.asyncSendPacket(ActiveMQSession.java:1649)
>         at
> org.apache.activemq.ActiveMQMessageConsumer.sendPullCommand(ActiveMQMessageConsumer.java:605)
>         at
> org.apache.activemq.ActiveMQMessageConsumer.receive(ActiveMQMessageConsumer.java:463)
>         at
> com.barra.cp.common.io.SingleMessageMultiQueueReceiver$OneMessageAtATime.runSingleQueue(SingleMessageMultiQueueReceiver.java:185)
>         at
> com.barra.cp.common.io.SingleMessageMultiQueueReceiver$OneMessageAtATime.doRun(SingleMessageMultiQueueReceiver.java:141)
>         at
> com.barra.cp.common.io.SingleMessageMultiQueueReceiver$OneMessageAtATime.run(SingleMessageMultiQueueReceiver.java:124)
>         at java.lang.Thread.run(Unknown Source)
> Caused by: java.io.IOException: Unknown data type: 20
>         at
> org.apache.activemq.openwire.OpenWireFormat.marshal(OpenWireFormat.java:231)
>         at
> org.apache.activemq.transport.tcp.TcpTransport.oneway(TcpTransport.java:108)
>         at
> org.apache.activemq.transport.InactivityMonitor.oneway(InactivityMonitor.java:142)
>         at
> org.apache.activemq.transport.TransportFilter.oneway(TransportFilter.java:82)
>         at
> org.apache.activemq.transport.WireFormatNegotiator.oneway(WireFormatNegotiator.java:86)
>         at
> org.apache.activemq.transport.MutexTransport.oneway(MutexTransport.java:45)
>         at
> org.apache.activemq.transport.ResponseCorrelator.oneway(ResponseCorrelator.java:59)
>         at
> org.apache.activemq.ActiveMQConnection.asyncSendPacket(ActiveMQConnection.java:1128)
>         ... 7 more
> --
> View this message in context: http://www.nabble.com/Pulling-consumer-design-tf2086371.html#a5757354
> Sent from the ActiveMQ - Dev forum at Nabble.com.
>
>


-- 

James
-------
http://radio.weblogs.com/0112098/

Re: Pulling consumer design

Posted by Vadim Pesochinsky <Va...@mscibarra.com>.
There is a little problem with MessagePullMarshaller not generated / added to
svn. I tried to run generator, but withouth much luck. Found this
instructions, but I could not find the maven-gram-plugin. Thanks.

cd maven-gram-plugin/
mvn install
cd ../activemq-openwire-generator/
mvn install
cd ../activemq-core
mvn gram:gram


javax.jms.JMSException: Unknown data type: 20
	at
org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:58)
	at
org.apache.activemq.ActiveMQConnection.asyncSendPacket(ActiveMQConnection.java:1130)
	at
org.apache.activemq.ActiveMQSession.asyncSendPacket(ActiveMQSession.java:1649)
	at
org.apache.activemq.ActiveMQMessageConsumer.sendPullCommand(ActiveMQMessageConsumer.java:605)
	at
org.apache.activemq.ActiveMQMessageConsumer.receive(ActiveMQMessageConsumer.java:463)
	at
com.barra.cp.common.io.SingleMessageMultiQueueReceiver$OneMessageAtATime.runSingleQueue(SingleMessageMultiQueueReceiver.java:185)
	at
com.barra.cp.common.io.SingleMessageMultiQueueReceiver$OneMessageAtATime.doRun(SingleMessageMultiQueueReceiver.java:141)
	at
com.barra.cp.common.io.SingleMessageMultiQueueReceiver$OneMessageAtATime.run(SingleMessageMultiQueueReceiver.java:124)
	at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: Unknown data type: 20
	at
org.apache.activemq.openwire.OpenWireFormat.marshal(OpenWireFormat.java:231)
	at
org.apache.activemq.transport.tcp.TcpTransport.oneway(TcpTransport.java:108)
	at
org.apache.activemq.transport.InactivityMonitor.oneway(InactivityMonitor.java:142)
	at
org.apache.activemq.transport.TransportFilter.oneway(TransportFilter.java:82)
	at
org.apache.activemq.transport.WireFormatNegotiator.oneway(WireFormatNegotiator.java:86)
	at
org.apache.activemq.transport.MutexTransport.oneway(MutexTransport.java:45)
	at
org.apache.activemq.transport.ResponseCorrelator.oneway(ResponseCorrelator.java:59)
	at
org.apache.activemq.ActiveMQConnection.asyncSendPacket(ActiveMQConnection.java:1128)
	... 7 more
-- 
View this message in context: http://www.nabble.com/Pulling-consumer-design-tf2086371.html#a5757354
Sent from the ActiveMQ - Dev forum at Nabble.com.


Re: Pulling consumer design

Posted by James Strachan <ja...@gmail.com>.
On 8/10/06, Pesochinskiy, Vadim (MSCIBARRA)
<Va...@mscibarra.com> wrote:
> Thanks a lot, this is great!!!
>
> In the standard amq distribution there is this all-including jar called
> incubator-activemq-4.0.1.jar.
>
> I cannot make maven build this. I use the following command, which
> creates all target jars but not the one I need.
>
> mvn -Dmaven.test.skip=true package

>From the activemq directory try

mvn clean install  -Dmaven.test.skip=true

the complete jar is created by the 'assembly' module in the assembly directory.

Note that in 4.1 onwards the jar is now called
apache-activemq-4.1-incubator..jar
-- 

James
-------
http://radio.weblogs.com/0112098/

RE: Pulling consumer design

Posted by "Pesochinskiy, Vadim (MSCIBARRA)" <Va...@mscibarra.com>.
Thanks a lot, this is great!!!

In the standard amq distribution there is this all-including jar called
incubator-activemq-4.0.1.jar.

I cannot make maven build this. I use the following command, which
creates all target jars but not the one I need.

mvn -Dmaven.test.skip=true package


-----Original Message-----
From: James Strachan [mailto:james.strachan@gmail.com] 
Sent: Thursday, August 10, 2006 11:49 AM
To: activemq-dev@geronimo.apache.org
Subject: Re: Pulling consumer design

On 8/10/06, Pesochinskiy, Vadim (MSCIBARRA)
<Va...@mscibarra.com> wrote:
> James,
>
> One way to implement this, which I think will fit with current design 
> is to introduce a MessagePullCommand, which informs the broker that 
> consumer is ready to accept next message. When broker get this request

> it dispatches one message to this consumer. What do you think about 
> this?

Good idea. Actually if you check SVN trunk I committed something like
this about an hour ago :)

I'm just committing a test case that shows it working as I type
(ZeroPrefetchConsumerTest) :)

So basically prefetch of zero can be supported for synchronous consumers
(where receive(long) or receive() is called). We throw an exception if
you try and use it for async subscription
(consumer.setMessageListener()).

The one issue with the current implementation is that the
receive(timeout) must wait long enough for a message to arrive from the
broker; otherwise the method may return but a message is dispatched just
shortly afterwards. So provided you give a reasonably large
receive(timeout) then it should do what you need.

-- 

James
-------
http://radio.weblogs.com/0112098/
--------------------------------------------------------

NOTICE: If received in error, please destroy and notify sender. Sender does not intend to waive confidentiality or privilege. Use of this email is prohibited when received in error.

Re: Pulling consumer design

Posted by James Strachan <ja...@gmail.com>.
On 8/10/06, Pesochinskiy, Vadim (MSCIBARRA)
<Va...@mscibarra.com> wrote:
> James,
>
> One way to implement this, which I think will fit with current design is
> to introduce a MessagePullCommand, which informs the broker that
> consumer is ready to accept next message. When broker get this request
> it dispatches one message to this consumer. What do you think about
> this?

Good idea. Actually if you check SVN trunk I committed something like
this about an hour ago :)

I'm just committing a test case that shows it working as I type
(ZeroPrefetchConsumerTest) :)

So basically prefetch of zero can be supported for synchronous
consumers (where receive(long) or receive() is called). We throw an
exception if you try and use it for async subscription
(consumer.setMessageListener()).

The one issue with the current implementation is that the
receive(timeout) must wait long enough for a message to arrive from
the broker; otherwise the method may return but a message is
dispatched just shortly afterwards. So provided you give a reasonably
large receive(timeout) then it should do what you need.

-- 

James
-------
http://radio.weblogs.com/0112098/