You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Lars Eirik Rønning <la...@gmail.com> on 2008/12/01 14:16:19 UTC

Message is sendt more than once

Hi.
I have some business logic which process xml from a que served by activemq.
I use receive() to get the xml from the que.
When i run my business logic without the que only one instance of the xml is
receveived, where as when asking to get messages from the que it sends the
same message twice.
at the moment i have set prefect to 1 so only one message should arrive at a
time. This is done via spring.

The weird thing is that when i stop my consumer and watch the webconsole
with the que it says only 1 message is wating to be delivered.When i
activate my consumer , the xml is sendt twice..

Hope you can help me with this.
I run activemq 5.1.0

Re: Message is sendt more than once

Posted by Lars Eirik Rønning <la...@gmail.com>.
Ignore this.It appeared i did som logging twice...:(

On Tue, Dec 2, 2008 at 8:42 AM, Lars Eirik Rønning <la...@gmail.com>wrote:

> thanks for all the help, but i am not able to get this working correctly.
> The code is like this:
>
> public void start(){
> try{
>
> ConnectionFactory factory = getTemplate().getConnectionFactory();
> con = factory.createConnection();
>  con.start();
> session =con.createSession(false,Session.AUTO_ACKNOWLEDGE);
>  MessageConsumer consumer =
> session.createConsumer(getTemplate().getDefaultDestination());
>  while(true){
> Message m = consumer.receive();
> handleMessage(m);
>  }
>   }
> catch(JMSException jms){
> jms.printStackTrace();
>  }
> }
>
> Could there be anything i am missing?
> I have also tried to run with
> session_createConsumer(true,Session.SESSION_TRANSACTED).
> In my method handleMessage i then tried to do session.comit(), but still no
> resolution to this problem.
>
> On Mon, Dec 1, 2008 at 4:59 PM, James Strachan <ja...@gmail.com>wrote:
>
>> 2008/12/1 Lars Eirik Rønning <la...@gmail.com>:
>> > hm, I think i only run session.comit().
>>
>> If you are using transacted sessions then use the SESSION_TRANSACTED
>> ack mode rather than CLIENT_ACKNOWLEDGED
>>
>>
>> > What is the method i need to run to acknowledge()..
>> >
>> > On Mon, Dec 1, 2008 at 4:36 PM, Gabe Westmaas
>> > <ga...@mailtrust.com>wrote:
>> >
>> >> And does your client acknowledge after it receives it?  If not, it will
>> >> read the message again later since the broker thinks it wasn't
>> received.
>> >>
>> >> -----Original Message-----
>> >> From: "Lars Eirik Rønning" <la...@gmail.com>
>> >> Sent: Monday, December 1, 2008 10:05am
>> >> To: users@activemq.apache.org
>> >> Subject: Re: Message is sendt more than once
>> >>
>> >> Hi i am using the following :session
>> >> =con.createSession(true,Session.CLIENT_ACKNOWLEDGE);
>> >>
>> >> On Mon, Dec 1, 2008 at 2:42 PM, Gabe Westmaas
>> >> <ga...@mailtrust.com>wrote:
>> >>
>> >> > Could be an acknowledgment issue, what type of acknowledge (client,
>> auto,
>> >> > dups ok, transaction) are you using?
>> >> >
>> >> > -----Original Message-----
>> >> > From: "Lars Eirik Rønning" <la...@gmail.com>
>> >> > Sent: Monday, December 1, 2008 8:16am
>> >> > To: users@activemq.apache.org
>> >> > Subject: Message is sendt more than once
>> >> >
>> >> > Hi.
>> >> > I have some business logic which process xml from a que served by
>> >> activemq.
>> >> > I use receive() to get the xml from the que.
>> >> > When i run my business logic without the que only one instance of the
>> xml
>> >> > is
>> >> > receveived, where as when asking to get messages from the que it
>> sends
>> >> the
>> >> > same message twice.
>> >> > at the moment i have set prefect to 1 so only one message should
>> arrive
>> >> at
>> >> > a
>> >> > time. This is done via spring.
>> >> >
>> >> > The weird thing is that when i stop my consumer and watch the
>> webconsole
>> >> > with the que it says only 1 message is wating to be delivered.When i
>> >> > activate my consumer , the xml is sendt twice..
>> >> >
>> >> > Hope you can help me with this.
>> >> > I run activemq 5.1.0
>> >> >
>> >> >
>> >> >
>> >>
>> >>
>> >>
>> >
>>
>>
>>
>> --
>> James
>> -------
>> http://macstrac.blogspot.com/
>>
>> Open Source Integration
>> http://fusesource.com/
>>
>
>

Re: Message is sendt more than once

Posted by Lars Eirik Rønning <la...@gmail.com>.
thanks for all the help, but i am not able to get this working correctly.
The code is like this:

public void start(){
try{

ConnectionFactory factory = getTemplate().getConnectionFactory();
con = factory.createConnection();
con.start();
session =con.createSession(false,Session.AUTO_ACKNOWLEDGE);
MessageConsumer consumer =
session.createConsumer(getTemplate().getDefaultDestination());
 while(true){
Message m = consumer.receive();
handleMessage(m);
}
 }
catch(JMSException jms){
jms.printStackTrace();
 }
}

Could there be anything i am missing?
I have also tried to run with
session_createConsumer(true,Session.SESSION_TRANSACTED).
In my method handleMessage i then tried to do session.comit(), but still no
resolution to this problem.

On Mon, Dec 1, 2008 at 4:59 PM, James Strachan <ja...@gmail.com>wrote:

> 2008/12/1 Lars Eirik Rønning <la...@gmail.com>:
> > hm, I think i only run session.comit().
>
> If you are using transacted sessions then use the SESSION_TRANSACTED
> ack mode rather than CLIENT_ACKNOWLEDGED
>
>
> > What is the method i need to run to acknowledge()..
> >
> > On Mon, Dec 1, 2008 at 4:36 PM, Gabe Westmaas
> > <ga...@mailtrust.com>wrote:
> >
> >> And does your client acknowledge after it receives it?  If not, it will
> >> read the message again later since the broker thinks it wasn't received.
> >>
> >> -----Original Message-----
> >> From: "Lars Eirik Rønning" <la...@gmail.com>
> >> Sent: Monday, December 1, 2008 10:05am
> >> To: users@activemq.apache.org
> >> Subject: Re: Message is sendt more than once
> >>
> >> Hi i am using the following :session
> >> =con.createSession(true,Session.CLIENT_ACKNOWLEDGE);
> >>
> >> On Mon, Dec 1, 2008 at 2:42 PM, Gabe Westmaas
> >> <ga...@mailtrust.com>wrote:
> >>
> >> > Could be an acknowledgment issue, what type of acknowledge (client,
> auto,
> >> > dups ok, transaction) are you using?
> >> >
> >> > -----Original Message-----
> >> > From: "Lars Eirik Rønning" <la...@gmail.com>
> >> > Sent: Monday, December 1, 2008 8:16am
> >> > To: users@activemq.apache.org
> >> > Subject: Message is sendt more than once
> >> >
> >> > Hi.
> >> > I have some business logic which process xml from a que served by
> >> activemq.
> >> > I use receive() to get the xml from the que.
> >> > When i run my business logic without the que only one instance of the
> xml
> >> > is
> >> > receveived, where as when asking to get messages from the que it sends
> >> the
> >> > same message twice.
> >> > at the moment i have set prefect to 1 so only one message should
> arrive
> >> at
> >> > a
> >> > time. This is done via spring.
> >> >
> >> > The weird thing is that when i stop my consumer and watch the
> webconsole
> >> > with the que it says only 1 message is wating to be delivered.When i
> >> > activate my consumer , the xml is sendt twice..
> >> >
> >> > Hope you can help me with this.
> >> > I run activemq 5.1.0
> >> >
> >> >
> >> >
> >>
> >>
> >>
> >
>
>
>
> --
> James
> -------
> http://macstrac.blogspot.com/
>
> Open Source Integration
> http://fusesource.com/
>

Re: Message is sendt more than once

Posted by James Strachan <ja...@gmail.com>.
2008/12/1 Lars Eirik Rønning <la...@gmail.com>:
> hm, I think i only run session.comit().

If you are using transacted sessions then use the SESSION_TRANSACTED
ack mode rather than CLIENT_ACKNOWLEDGED


> What is the method i need to run to acknowledge()..
>
> On Mon, Dec 1, 2008 at 4:36 PM, Gabe Westmaas
> <ga...@mailtrust.com>wrote:
>
>> And does your client acknowledge after it receives it?  If not, it will
>> read the message again later since the broker thinks it wasn't received.
>>
>> -----Original Message-----
>> From: "Lars Eirik Rønning" <la...@gmail.com>
>> Sent: Monday, December 1, 2008 10:05am
>> To: users@activemq.apache.org
>> Subject: Re: Message is sendt more than once
>>
>> Hi i am using the following :session
>> =con.createSession(true,Session.CLIENT_ACKNOWLEDGE);
>>
>> On Mon, Dec 1, 2008 at 2:42 PM, Gabe Westmaas
>> <ga...@mailtrust.com>wrote:
>>
>> > Could be an acknowledgment issue, what type of acknowledge (client, auto,
>> > dups ok, transaction) are you using?
>> >
>> > -----Original Message-----
>> > From: "Lars Eirik Rønning" <la...@gmail.com>
>> > Sent: Monday, December 1, 2008 8:16am
>> > To: users@activemq.apache.org
>> > Subject: Message is sendt more than once
>> >
>> > Hi.
>> > I have some business logic which process xml from a que served by
>> activemq.
>> > I use receive() to get the xml from the que.
>> > When i run my business logic without the que only one instance of the xml
>> > is
>> > receveived, where as when asking to get messages from the que it sends
>> the
>> > same message twice.
>> > at the moment i have set prefect to 1 so only one message should arrive
>> at
>> > a
>> > time. This is done via spring.
>> >
>> > The weird thing is that when i stop my consumer and watch the webconsole
>> > with the que it says only 1 message is wating to be delivered.When i
>> > activate my consumer , the xml is sendt twice..
>> >
>> > Hope you can help me with this.
>> > I run activemq 5.1.0
>> >
>> >
>> >
>>
>>
>>
>



-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://fusesource.com/

Re: Message is sendt more than once

Posted by Lars Eirik Rønning <la...@gmail.com>.
hm, I think i only run session.comit().
What is the method i need to run to acknowledge()..

On Mon, Dec 1, 2008 at 4:36 PM, Gabe Westmaas
<ga...@mailtrust.com>wrote:

> And does your client acknowledge after it receives it?  If not, it will
> read the message again later since the broker thinks it wasn't received.
>
> -----Original Message-----
> From: "Lars Eirik Rønning" <la...@gmail.com>
> Sent: Monday, December 1, 2008 10:05am
> To: users@activemq.apache.org
> Subject: Re: Message is sendt more than once
>
> Hi i am using the following :session
> =con.createSession(true,Session.CLIENT_ACKNOWLEDGE);
>
> On Mon, Dec 1, 2008 at 2:42 PM, Gabe Westmaas
> <ga...@mailtrust.com>wrote:
>
> > Could be an acknowledgment issue, what type of acknowledge (client, auto,
> > dups ok, transaction) are you using?
> >
> > -----Original Message-----
> > From: "Lars Eirik Rønning" <la...@gmail.com>
> > Sent: Monday, December 1, 2008 8:16am
> > To: users@activemq.apache.org
> > Subject: Message is sendt more than once
> >
> > Hi.
> > I have some business logic which process xml from a que served by
> activemq.
> > I use receive() to get the xml from the que.
> > When i run my business logic without the que only one instance of the xml
> > is
> > receveived, where as when asking to get messages from the que it sends
> the
> > same message twice.
> > at the moment i have set prefect to 1 so only one message should arrive
> at
> > a
> > time. This is done via spring.
> >
> > The weird thing is that when i stop my consumer and watch the webconsole
> > with the que it says only 1 message is wating to be delivered.When i
> > activate my consumer , the xml is sendt twice..
> >
> > Hope you can help me with this.
> > I run activemq 5.1.0
> >
> >
> >
>
>
>

Re: Message is sendt more than once

Posted by Gabe Westmaas <ga...@mailtrust.com>.
And does your client acknowledge after it receives it?  If not, it will read the message again later since the broker thinks it wasn't received.

-----Original Message-----
From: "Lars Eirik Rønning" <la...@gmail.com>
Sent: Monday, December 1, 2008 10:05am
To: users@activemq.apache.org
Subject: Re: Message is sendt more than once

Hi i am using the following :session
=con.createSession(true,Session.CLIENT_ACKNOWLEDGE);

On Mon, Dec 1, 2008 at 2:42 PM, Gabe Westmaas
<ga...@mailtrust.com>wrote:

> Could be an acknowledgment issue, what type of acknowledge (client, auto,
> dups ok, transaction) are you using?
>
> -----Original Message-----
> From: "Lars Eirik Rønning" <la...@gmail.com>
> Sent: Monday, December 1, 2008 8:16am
> To: users@activemq.apache.org
> Subject: Message is sendt more than once
>
> Hi.
> I have some business logic which process xml from a que served by activemq.
> I use receive() to get the xml from the que.
> When i run my business logic without the que only one instance of the xml
> is
> receveived, where as when asking to get messages from the que it sends the
> same message twice.
> at the moment i have set prefect to 1 so only one message should arrive at
> a
> time. This is done via spring.
>
> The weird thing is that when i stop my consumer and watch the webconsole
> with the que it says only 1 message is wating to be delivered.When i
> activate my consumer , the xml is sendt twice..
>
> Hope you can help me with this.
> I run activemq 5.1.0
>
>
>



Re: Message is sendt more than once

Posted by Lars Eirik Rønning <la...@gmail.com>.
Hi i am using the following :session
=con.createSession(true,Session.CLIENT_ACKNOWLEDGE);

On Mon, Dec 1, 2008 at 2:42 PM, Gabe Westmaas
<ga...@mailtrust.com>wrote:

> Could be an acknowledgment issue, what type of acknowledge (client, auto,
> dups ok, transaction) are you using?
>
> -----Original Message-----
> From: "Lars Eirik Rønning" <la...@gmail.com>
> Sent: Monday, December 1, 2008 8:16am
> To: users@activemq.apache.org
> Subject: Message is sendt more than once
>
> Hi.
> I have some business logic which process xml from a que served by activemq.
> I use receive() to get the xml from the que.
> When i run my business logic without the que only one instance of the xml
> is
> receveived, where as when asking to get messages from the que it sends the
> same message twice.
> at the moment i have set prefect to 1 so only one message should arrive at
> a
> time. This is done via spring.
>
> The weird thing is that when i stop my consumer and watch the webconsole
> with the que it says only 1 message is wating to be delivered.When i
> activate my consumer , the xml is sendt twice..
>
> Hope you can help me with this.
> I run activemq 5.1.0
>
>
>

RE: Message is sendt more than once

Posted by Gabe Westmaas <ga...@mailtrust.com>.
Could be an acknowledgment issue, what type of acknowledge (client, auto, dups ok, transaction) are you using?

-----Original Message-----
From: "Lars Eirik Rønning" <la...@gmail.com>
Sent: Monday, December 1, 2008 8:16am
To: users@activemq.apache.org
Subject: Message is sendt more than once

Hi.
I have some business logic which process xml from a que served by activemq.
I use receive() to get the xml from the que.
When i run my business logic without the que only one instance of the xml is
receveived, where as when asking to get messages from the que it sends the
same message twice.
at the moment i have set prefect to 1 so only one message should arrive at a
time. This is done via spring.

The weird thing is that when i stop my consumer and watch the webconsole
with the que it says only 1 message is wating to be delivered.When i
activate my consumer , the xml is sendt twice..

Hope you can help me with this.
I run activemq 5.1.0