You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Sandeep Chayapathi <sa...@wssource.com> on 2006/08/01 15:35:44 UTC
Stomp - message woes - Ruby client
Hi all,
This is a followup to my earlier mail regarding Stomp and the perl
client. I have a simple producer and consumer, using ruby client. Im
using AMQ 4.0.1.
The problem is, every other message is missed by the consumer.
Moreover, after a message has been consumed, it is not being removed
from the queue.
Im not able to figure out what the issue is. Any help is greatly
appreciated. Thanks in advance.
Here is the destination policy being used:
---- activemq.xml ----
<destinationPolicy>
<policyMap><policyEntries>
<policyEntry topic="FOO.>">
<dispatchPolicy>
<strictOrderDispatchPolicy />
</dispatchPolicy>
<subscriptionRecoveryPolicy>
<lastImageSubscriptionRecoveryPolicy />
</subscriptionRecoveryPolicy>
</policyEntry>
</policyEntries></policyMap>
</destinationPolicy>
-----------------------
Here is the code:
---- read.rb ------
#!/usr/bin/env ruby
require 'stomp'
client = Stomp::Connection.new("test","user")
client.subscribe "/queue/FOO.test"
while TRUE
puts "sleeping"
sleep 0.01
msg = client.receive
puts msg.body
end
--------------------
---- write.rb ------
#!/usr/bin/env ruby
require 'stomp'
client = Stomp::Connection.new("test","user")
client.subscribe "/queue/FOO.test"
for i in 0..10
sleep 1
client.send "/queue/FOO.test", "[Ruby] message " + i.to_s
puts "[Ruby] message " + i.to_s
end
client.disconnect
---------------------
Re: Stomp - message woes - Ruby client
Posted by Sandeep Chayapathi <sa...@wssource.com>.
Hi ,
Acknowledging the message worked. Thanks for all the help.
Now the problems I faced seems trivial. If anyone is following this
thread, here is the updated code:
---- read.rb -----
#!/usr/bin/env ruby
require 'stomp'
client = Stomp::Connection.new("test","user")
client.subscribe "/queue/FOO.test"
while TRUE
puts "sleeping"
sleep 1
msg = client.receive
puts msg.body
client.ack msg
end
------------------
---- write.rb ------
#!/usr/bin/env ruby
require 'stomp'
client = Stomp::Connection.new("test","user")
for i in 0..10
sleep 1
client.send "/queue/FOO.test", "[Ruby] message " + i.to_s
puts "[Ruby] message " + i.to_s
end
client.disconnect
------------------
- Sandeep
> > However, the messages, once read , are still being retained in the
> > queue. Any suggestion on that one ? thanks.
>
> Sounds like you might want to acknowledge them maybe? There might be a
> bug with auto-ack in stomp possbly but you can always explicitly
> acknowledge a message when you are done with it.
>
Re: Stomp - message woes - Ruby client
Posted by James Strachan <ja...@gmail.com>.
On 8/1/06, Sandeep Chayapathi <sa...@wssource.com> wrote:
> oops. muy bad. I misread the stomp protocol. After removing the
> "subscribe" from the write.rb, Im able to receive all the messages.
> Thanks for the help
:)
> However, the messages, once read , are still being retained in the
> queue. Any suggestion on that one ? thanks.
Sounds like you might want to acknowledge them maybe? There might be a
bug with auto-ack in stomp possbly but you can always explicitly
acknowledge a message when you are done with it.
--
James
-------
http://radio.weblogs.com/0112098/
Re: Stomp - message woes - Ruby client
Posted by Sandeep Chayapathi <sa...@wssource.com>.
oops. muy bad. I misread the stomp protocol. After removing the
"subscribe" from the write.rb, Im able to receive all the messages.
Thanks for the help
However, the messages, once read , are still being retained in the
queue. Any suggestion on that one ? thanks.
- Sandeep
On Tue, 2006-08-01 at 14:54 +0100, James Strachan wrote:
> why is write.rb subscribing to the queue as well?
>
> On 8/1/06, Sandeep Chayapathi <sa...@wssource.com> wrote:
> > Hi,
> >
> > When I run both, write.rb and read.rb, the ConsumerCount for queue
> > FOO.test is 2. Once write.rb is finished, the ConsumerCount drops to 1.
> >
> > - Sandep
> >
> > On Tue, 2006-08-01 at 14:41 +0100, James Strachan wrote:
> > > If you look in JMX do you see just a single consumer?
> > >
> > > http://incubator.apache.org/activemq/jmx.html
> > >
> > > On 8/1/06, Sandeep Chayapathi <sa...@wssource.com> wrote:
> > > > Hi all,
> > > >
> > > > This is a followup to my earlier mail regarding Stomp and the perl
> > > > client. I have a simple producer and consumer, using ruby client. Im
> > > > using AMQ 4.0.1.
> > > >
> > > > The problem is, every other message is missed by the consumer.
> > > > Moreover, after a message has been consumed, it is not being removed
> > > > from the queue.
> > > >
> > > > Im not able to figure out what the issue is. Any help is greatly
> > > > appreciated. Thanks in advance.
> > > >
> > > > Here is the destination policy being used:
> > > >
> > > > ---- activemq.xml ----
> > > > <destinationPolicy>
> > > > <policyMap><policyEntries>
> > > >
> > > > <policyEntry topic="FOO.>">
> > > > <dispatchPolicy>
> > > > <strictOrderDispatchPolicy />
> > > > </dispatchPolicy>
> > > > <subscriptionRecoveryPolicy>
> > > > <lastImageSubscriptionRecoveryPolicy />
> > > > </subscriptionRecoveryPolicy>
> > > > </policyEntry>
> > > >
> > > > </policyEntries></policyMap>
> > > > </destinationPolicy>
> > > > -----------------------
> > > >
> > > >
> > > > Here is the code:
> > > >
> > > > ---- read.rb ------
> > > > #!/usr/bin/env ruby
> > > > require 'stomp'
> > > >
> > > > client = Stomp::Connection.new("test","user")
> > > >
> > > > client.subscribe "/queue/FOO.test"
> > > >
> > > > while TRUE
> > > > puts "sleeping"
> > > > sleep 0.01
> > > > msg = client.receive
> > > > puts msg.body
> > > > end
> > > > --------------------
> > > >
> > > >
> > > > ---- write.rb ------
> > > > #!/usr/bin/env ruby
> > > > require 'stomp'
> > > >
> > > > client = Stomp::Connection.new("test","user")
> > > >
> > > > client.subscribe "/queue/FOO.test"
> > > >
> > > >
> > > >
> > > > for i in 0..10
> > > > sleep 1
> > > > client.send "/queue/FOO.test", "[Ruby] message " + i.to_s
> > > > puts "[Ruby] message " + i.to_s
> > > > end
> > > >
> > > > client.disconnect
> > > > ---------------------
> > > >
> > > >
> > >
> > >
> >
> >
>
>
Re: Stomp - message woes - Ruby client
Posted by James Strachan <ja...@gmail.com>.
why is write.rb subscribing to the queue as well?
On 8/1/06, Sandeep Chayapathi <sa...@wssource.com> wrote:
> Hi,
>
> When I run both, write.rb and read.rb, the ConsumerCount for queue
> FOO.test is 2. Once write.rb is finished, the ConsumerCount drops to 1.
>
> - Sandep
>
> On Tue, 2006-08-01 at 14:41 +0100, James Strachan wrote:
> > If you look in JMX do you see just a single consumer?
> >
> > http://incubator.apache.org/activemq/jmx.html
> >
> > On 8/1/06, Sandeep Chayapathi <sa...@wssource.com> wrote:
> > > Hi all,
> > >
> > > This is a followup to my earlier mail regarding Stomp and the perl
> > > client. I have a simple producer and consumer, using ruby client. Im
> > > using AMQ 4.0.1.
> > >
> > > The problem is, every other message is missed by the consumer.
> > > Moreover, after a message has been consumed, it is not being removed
> > > from the queue.
> > >
> > > Im not able to figure out what the issue is. Any help is greatly
> > > appreciated. Thanks in advance.
> > >
> > > Here is the destination policy being used:
> > >
> > > ---- activemq.xml ----
> > > <destinationPolicy>
> > > <policyMap><policyEntries>
> > >
> > > <policyEntry topic="FOO.>">
> > > <dispatchPolicy>
> > > <strictOrderDispatchPolicy />
> > > </dispatchPolicy>
> > > <subscriptionRecoveryPolicy>
> > > <lastImageSubscriptionRecoveryPolicy />
> > > </subscriptionRecoveryPolicy>
> > > </policyEntry>
> > >
> > > </policyEntries></policyMap>
> > > </destinationPolicy>
> > > -----------------------
> > >
> > >
> > > Here is the code:
> > >
> > > ---- read.rb ------
> > > #!/usr/bin/env ruby
> > > require 'stomp'
> > >
> > > client = Stomp::Connection.new("test","user")
> > >
> > > client.subscribe "/queue/FOO.test"
> > >
> > > while TRUE
> > > puts "sleeping"
> > > sleep 0.01
> > > msg = client.receive
> > > puts msg.body
> > > end
> > > --------------------
> > >
> > >
> > > ---- write.rb ------
> > > #!/usr/bin/env ruby
> > > require 'stomp'
> > >
> > > client = Stomp::Connection.new("test","user")
> > >
> > > client.subscribe "/queue/FOO.test"
> > >
> > >
> > >
> > > for i in 0..10
> > > sleep 1
> > > client.send "/queue/FOO.test", "[Ruby] message " + i.to_s
> > > puts "[Ruby] message " + i.to_s
> > > end
> > >
> > > client.disconnect
> > > ---------------------
> > >
> > >
> >
> >
>
>
--
James
-------
http://radio.weblogs.com/0112098/
Re: Stomp - message woes - Ruby client
Posted by Sandeep Chayapathi <sa...@wssource.com>.
Hi,
When I run both, write.rb and read.rb, the ConsumerCount for queue
FOO.test is 2. Once write.rb is finished, the ConsumerCount drops to 1.
- Sandep
On Tue, 2006-08-01 at 14:41 +0100, James Strachan wrote:
> If you look in JMX do you see just a single consumer?
>
> http://incubator.apache.org/activemq/jmx.html
>
> On 8/1/06, Sandeep Chayapathi <sa...@wssource.com> wrote:
> > Hi all,
> >
> > This is a followup to my earlier mail regarding Stomp and the perl
> > client. I have a simple producer and consumer, using ruby client. Im
> > using AMQ 4.0.1.
> >
> > The problem is, every other message is missed by the consumer.
> > Moreover, after a message has been consumed, it is not being removed
> > from the queue.
> >
> > Im not able to figure out what the issue is. Any help is greatly
> > appreciated. Thanks in advance.
> >
> > Here is the destination policy being used:
> >
> > ---- activemq.xml ----
> > <destinationPolicy>
> > <policyMap><policyEntries>
> >
> > <policyEntry topic="FOO.>">
> > <dispatchPolicy>
> > <strictOrderDispatchPolicy />
> > </dispatchPolicy>
> > <subscriptionRecoveryPolicy>
> > <lastImageSubscriptionRecoveryPolicy />
> > </subscriptionRecoveryPolicy>
> > </policyEntry>
> >
> > </policyEntries></policyMap>
> > </destinationPolicy>
> > -----------------------
> >
> >
> > Here is the code:
> >
> > ---- read.rb ------
> > #!/usr/bin/env ruby
> > require 'stomp'
> >
> > client = Stomp::Connection.new("test","user")
> >
> > client.subscribe "/queue/FOO.test"
> >
> > while TRUE
> > puts "sleeping"
> > sleep 0.01
> > msg = client.receive
> > puts msg.body
> > end
> > --------------------
> >
> >
> > ---- write.rb ------
> > #!/usr/bin/env ruby
> > require 'stomp'
> >
> > client = Stomp::Connection.new("test","user")
> >
> > client.subscribe "/queue/FOO.test"
> >
> >
> >
> > for i in 0..10
> > sleep 1
> > client.send "/queue/FOO.test", "[Ruby] message " + i.to_s
> > puts "[Ruby] message " + i.to_s
> > end
> >
> > client.disconnect
> > ---------------------
> >
> >
>
>
Re: Stomp - message woes - Ruby client
Posted by James Strachan <ja...@gmail.com>.
If you look in JMX do you see just a single consumer?
http://incubator.apache.org/activemq/jmx.html
On 8/1/06, Sandeep Chayapathi <sa...@wssource.com> wrote:
> Hi all,
>
> This is a followup to my earlier mail regarding Stomp and the perl
> client. I have a simple producer and consumer, using ruby client. Im
> using AMQ 4.0.1.
>
> The problem is, every other message is missed by the consumer.
> Moreover, after a message has been consumed, it is not being removed
> from the queue.
>
> Im not able to figure out what the issue is. Any help is greatly
> appreciated. Thanks in advance.
>
> Here is the destination policy being used:
>
> ---- activemq.xml ----
> <destinationPolicy>
> <policyMap><policyEntries>
>
> <policyEntry topic="FOO.>">
> <dispatchPolicy>
> <strictOrderDispatchPolicy />
> </dispatchPolicy>
> <subscriptionRecoveryPolicy>
> <lastImageSubscriptionRecoveryPolicy />
> </subscriptionRecoveryPolicy>
> </policyEntry>
>
> </policyEntries></policyMap>
> </destinationPolicy>
> -----------------------
>
>
> Here is the code:
>
> ---- read.rb ------
> #!/usr/bin/env ruby
> require 'stomp'
>
> client = Stomp::Connection.new("test","user")
>
> client.subscribe "/queue/FOO.test"
>
> while TRUE
> puts "sleeping"
> sleep 0.01
> msg = client.receive
> puts msg.body
> end
> --------------------
>
>
> ---- write.rb ------
> #!/usr/bin/env ruby
> require 'stomp'
>
> client = Stomp::Connection.new("test","user")
>
> client.subscribe "/queue/FOO.test"
>
>
>
> for i in 0..10
> sleep 1
> client.send "/queue/FOO.test", "[Ruby] message " + i.to_s
> puts "[Ruby] message " + i.to_s
> end
>
> client.disconnect
> ---------------------
>
>
--
James
-------
http://radio.weblogs.com/0112098/