activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lars Eirik Rønning" <larsei...@gmail.com>
Subject Re: Activemq5 - Messages redelivered..
Date Thu, 25 Sep 2008 13:26:33 GMT
public void start()throws JMSException{
        try{
            ConnectionFactory factory = template.getConnectionFactory();
            Connection con = factory.createConnection();
            con.start();
            session =con.createSession(true,Session.CLIENT_ACKNOWLEDGE);
            MessageConsumer consumer =
session.createConsumer(template.getDefaultDestination());
            consumer.setMessageListener(this);


        }
        catch(JMSException jms){
            jms.printStackTrace();
        }
    }

  public void onMessage(Message message){
        if(message!=null){
            try{
                TextMessage txtMessage = (TextMessage)message;
                message.acknowledge();

            }
            catch(Exception e){
                e.printStackTrace();
            }
        }

Thanks.

On Thu, Sep 25, 2008 at 2:59 PM, Joe Fernandez <
joe.fernandez@ttmsolutions.com> wrote:

>
> Can you post the consuming portion of your code?
>
> Joe
>
>
> titten wrote:
> >
> > Hi.
> > I have tried both
> > session =con.createSession(true,Session.CLIENT_ACKNOWLEDGE);
> > and
> > session =con.createSession(true,Session.AUTO_ACKNOWLEDGE);
> >
> > When using client ack i have specifically added in my onMessageMethod:
> > message.acknowledge();
> >
> > Thanks.
> >
> >
> > On Thu, Sep 25, 2008 at 1:47 PM, Joe Fernandez <
> > joe.fernandez@ttmsolutions.com> wrote:
> >
> >>
> >> Sounds like an 'ack' related issue. What acknowledge mode are you using
> >> for
> >> your consumer?
> >>
> >> Joe
> >> Get a free ActiveMQ user guide @ http://www.ttmsolutions.com
> >>
> >>
> >> titten wrote:
> >> >
> >> > Hi.
> >> > I am having a problem with getting the same messages redelivered to my
> >> > client.
> >> > The configuration is Apache ActiveMq5 with pure jdbc mode running
> >> mysql.
> >> >
> >> > The strange thing is that when i was running the my client in the same
> >> jvm
> >> > as the broker using spring with a listenerconfiguration the problem
> >> does
> >> > not
> >> > occur.
> >> > I recently created to standalone applications which do either send or
> >> > receive messages.
> >> > After creating these applications my consumer application receives the
> >> > same
> >> > messages over again..
> >> > The only difference in code between the first approach and the second
> >> is
> >> > that the latter establishes a second jvm which listens for messages on
> >> a
> >> > que.
> >> > I have implemented the messagelistener interface and registerred this
> >> with
> >> > the consumer.
> >> > I have not at the moment registerred and particular id for my
> consumer.
> >> > Could this be of importance?
> >> > The class being used is the standard ActiveMqQue class.
> >> >
> >> > I hope you are able to help me with this problem.
> >> >
> >> > Lars
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/Activemq5---Messages-redelivered..-tp19650989p19667885.html
> >> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Activemq5---Messages-redelivered..-tp19650989p19669035.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message