Pending Message ?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Pending Message ?

darkrwe
Hello guys !

I'm using activeMQ cms c++ libraries and ActiveMQ 5.8.0 as a broker.

Summary of what i'm doing is:
I have created an connection in main process in my project.
I passed the this connection to a thread and also created a fork process from this thread.
But in this child process when i just send a message to a queue. These messages are listed on pending message list.
I could not consume any messages that sent from these child process.

is there anyone that knows why these messages are in pending message list in broker?
and i cannot consume?
Reply | Threaded
Open this post in threaded view
|

Re: Pending Message ?

stargate
Hi,

i can not help you, but i have exact the same problem with ActiveMQ and Java. But not all messages are pending.. if i send of course 40 message`s then 30 are delivered and 8 are pending, and i don`t know why they are pending und how i can tell the broker/consumer that he should deliver this pending messages.

Best regards
stargate
Reply | Threaded
Open this post in threaded view
|

Re: Pending Message ?

darkrwe
This post was updated on .
I think the problem is about forking and all address space of parent process copied to fork process:

But the interesting thing is that i just send the pointer of my connection and session to thread and this child process just used main process's connection and session and its consumer/producers..

you are right 1 message is enqueued in the queue. the rest are in pending list...

Anyway after this problem i research the problem a little bit more. I realize that if you use a thread with ActiveMQ you should open a new session for each thread.

I tried this i just send the connection pointer to thread and open a new session and create a new consumer from it.
result: It is working with no problem.

Besides:
I also tried vfork function instead of fork in my thread .
result: it is working too.
But as you know the difference between fork and vfork functions. (i dont want to use vfork it is dangerous)

yeap here it is all my experience with usage of activeMQ.
Maybe someone could explain the situation in details..