You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by JigarP <ji...@gmail.com> on 2007/09/07 13:41:26 UTC

Able to send message to ActiveMQ but Not getting reply to Client

Hi ,

   I am using ActiveMQ/AJAX for my web based application. I have integrated
ajax successfully in my application but getting below issue sometime.

1) I send message to MQ but not getting reply to client browser but other
browsers are getting reply who are registered for same topic.

2)  is there any way to check whether our listener is listening to topic?if
not connected so we can retry and connect so we will not miss any message.

3)  i am not able to make stable my application because of above issue. can
you suggest some technique for ajax with activemq so i can try out.

awaiting your reply,

Jigar
-- 
View this message in context: http://www.nabble.com/Able-to-send-message-to-ActiveMQ-but-Not-getting-reply-to-Client-tf4400842s2354.html#a12553636
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Able to send message to ActiveMQ but Not getting reply to Client

Posted by chago <na...@visualxs.com>.
You have created two channels, sorta; the first is topic://doChat and the
second is '/topic/ChatTopic', which does not conform to the url notation
that you should be using. That might be your problem.

I assume that you have your own server-side Java classes that listen for
incoming messages on topic://doChat and send replies on topic://ChatTopic?

-- jim




JigarP wrote:
> 
> Hi Chago,
> 
>      you have explain each scenario clearly. just want to know that at
> server side/client side what sort of confuguration should i do so that
> atleast it will not destroy my consumer. i am attaching my client side
> code let me know if you get some clue.
> 
> Below three methods i am calling in below sequence.
> 
> 1) When page is loaded register listener topic using onStartListen()
> method.
> 2) When user enter message and click on send message then it will call
> onSendMessage() method.
> 3) call handleNewMessage() if we get any message.
> 
> /**
> below are the topic which we are using to send chat to server and get
> reply from server.
> **/
> function setTopicName(){
> 	sendTopicName = 'topic://doChat' ;
> 	receiveTopicName = '/topic/ChatTopic';
>  
> }
> /**
> This method register topic to MQ.
> **/
> function onStartListen(){
>     setTopicName();
>     amq.addListener('chat', receiveTopicName, handleNewMessage);
> 
> }
> 
> /**
> This method will chat message to MQ 
> **/
> function onSendMessage(msgStr){
>     amq.sendMessage(sendTopicName, msgStr);
> }
> function handleNewMessage(){
> //process the received message.
> }
> 
> I have found that if i click on send button continuosly then messages are
> coming to servr as well as it also resides at activemq but i am not able
> to get messages at client side back.
> 
> I hope u are able to understand this.
> 

-- 
View this message in context: http://www.nabble.com/Able-to-send-message-to-ActiveMQ-but-Not-getting-reply-to-Client-tf4400842s2354.html#a12941187
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Able to send message to ActiveMQ but Not getting reply to Client

Posted by JigarP <ji...@gmail.com>.
Hi Chago,

     you have explain each scenario clearly. just want to know that at
server side/client side what sort of confuguration should i do so that
atleast it will not destroy my consumer. i am attaching my client side code
let me know if you get some clue.

Below three methods i am calling in below sequence.

1) When page is loaded register listener topic using onStartListen() method.
2) When user enter message and click on send message then it will call
onSendMessage() method.
3) call handleNewMessage() if we get any message.

/**
below are the topic which we are using to send chat to server and get reply
from server.
**/
function setTopicName(){
	sendTopicName = 'topic://doChat' ;
	receiveTopicName = '/topic/ChatTopic';
 
}
/**
This method register topic to MQ.
**/
function onStartListen(){
    setTopicName();
    amq.addListener('chat', receiveTopicName, handleNewMessage);

}

/**
This method will chat message to MQ 
**/
function onSendMessage(msgStr){
    amq.sendMessage(sendTopicName, msgStr);
}
function handleNewMessage(){
//process the received message.
}

I have found that if i click on send button continuosly then messages are
coming to servr as well as it also resides at activemq but i am not able to
get messages at client side back.

I hope u are able to understand this.

chago wrote:
> 
> When amq.addListener(id, destination, handler) is invoked for the first
> time, the javascript class creates a POST request to the AjaxServlet. The
> AjaxServlet is really just a facade to the MessageListenerServlet which in
> turn extends MessageServletSupport. The POST request takes the Javascript
> parameters and turns them into:
>     - destination = destination
>     - message = id
>     - type = 'listen'
> 
> The servlet then performs the following functions:
> 
> 1. A Destination is created based on the POST parameter 'destination'. I
> haven't traced this very far into ActiveMQ, but it seems to create a new
> Topic/Queue each time it is called, even if that destiantion already
> existed. Perhaps the newly created destination is just a proxy to a
> permanent destination? I was surprised that the code doesn't check for the
> existence of the detination before creating a new one. Can anyone
> elaborate?
> 
> 2. The MessageListenerServlet will create a Listener and store it in the
> client's HTTP Session under the parameter name 'mls.listener'.  The
> Listener class is notified when a message is available via its
> onMessageAvailable(MessageConsumer) method.
> 
> 3. The MLS will create a HashMap of consumer IDs. The key to this map is a
> MessageAvailableConsumer and the value is a String that holds the 'id'
> value passed to the javascript function. This map is also stored in the
> client's HTTP Session under the parameter name of 'mls.consumerIdMap'. The
> map is empty at this time.
> 
> 4. The MLS will also create an empty HashMap that allows lookup of a
> destination name based on an instance of MessageAvailableConsumer. This
> map is stored in the session under 'mls.consumerDestinationNameMap'.
> 
> 5. If any consumers had been previously created for the given destination,
> they are closed.
> 
> 6. If a MessageConsumer already exists for the given destination it is
> used, otherwise a new MessageConsumer is created. A MessageConsumer is a
> JMS construct that receives messages from the JMS broker. The
> MessageConsumer that is created is instanced in the WebClient class which
> is also stored in the HTTP session.
> 
> 7. The Listener created earlier is associated with the consumer to allow
> for asynchronous receipt of messages.
> 
> 8. The MessageConsumer is related to the id parameter and the destination
> name using the prior two maps. 
> 
> That's how a consumer is created. The only ways a consumer is destroyed in
> the normal course of operation are:
> 
> 1. amq.removeListener(id, destination) is invoked causing the server to
> process an 'unlisten' message.
> 
> 2. amq.addListener(id, destination, callback) is invoked causing the
> server to process a 'listen' message. If a prior consumer was created
> using this destination, it is closed. (See #5 above.)
> 
> 3. If the Listener class receives an onMessageAvailable call, and the
> Listener hasn't been called for 50 secs, the consumer is closed. This
> appears to me to be an attempt to close those consumers who have not
> polled for two cycles. I am asuming that this is the server cleaning up
> consumers that are no longer needed because the browser has closed. Adding
> a debug message to this section of code would be useful.
> 
> 4. When the HTTP session passivates or is closed, the WebClient is closed
> along with all the consumers.
> 
> Things to look for in your debug log are messages relating to the closing
> of consumers. Mine looks like this:
> 2007-09-24 20:07:19,968 DEBUG [VMTransport ]
> (he.activemq.broker.region.AbstractRegion)
> Removing consumer: ID:zd7000-2475-1190676467171-2:0:1:1
> 
> I'd like to see your client-side code. Are you doing anything server-side?
> 
> -- jim
> 
> 
> JigarP wrote:
>> 
>> Hi Chago,
>> 
>>    Ya, you are right. when _amq.js is loaded polling will start. i agree
>> that that time listener will not be there but when i register my listener
>> using amq.aadListener then after it should get data,rgt. so even if i
>> have registered my listener i was not able to get any messages. so i
>> think ajaxservlet will be removing listener at server side on the basis
>> of the condition. i dont know when they remove consumer for specifit
>> topic/channel from server.
>> 
>> which side of code u want to check. server side or javascript?
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Able-to-send-message-to-ActiveMQ-but-Not-getting-reply-to-Client-tf4400842s2354.html#a12933912
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Able to send message to ActiveMQ but Not getting reply to Client

Posted by chago <na...@visualxs.com>.
When amq.addListener(id, destination, handler) is invoked for the first time,
the javascript class creates a POST request to the AjaxServlet. The
AjaxServlet is really just a facade to the MessageListenerServlet which in
turn extends MessageServletSupport. The POST request takes the Javascript
parameters and turns them into:
    - destination = destination
    - message = id
    - type = 'listen'

The servlet then performs the following functions:

1. A Destination is created based on the POST parameter 'destination'. I
haven't traced this very far into ActiveMQ, but it seems to create a new
Topic/Queue each time it is called, even if that destiantion already
existed. Perhaps the newly created destination is just a proxy to a
permanent destination? I was surprised that the code doesn't check for the
existence of the detination before creating a new one. Can anyone elaborate?

2. The MessageListenerServlet will create a Listener and store it in the
client's HTTP Session under the parameter name 'mls.listener'.  The Listener
class is notified when a message is available via its
onMessageAvailable(MessageConsumer) method.

3. The MLS will create a HashMap of consumer IDs. The key to this map is a
MessageAvailableConsumer and the value is a String that holds the 'id' value
passed to the javascript function. This map is also stored in the client's
HTTP Session under the parameter name of 'mls.consumerIdMap'. The map is
empty at this time.

4. The MLS will also create an empty HashMap that allows lookup of a
destination name based on an instance of MessageAvailableConsumer. This map
is stored in the session under 'mls.consumerDestinationNameMap'.

5. If any consumers had been previously created for the given destination,
they are closed.

6. If a MessageConsumer already exists for the given destination it is used,
otherwise a new MessageConsumer is created. A MessageConsumer is a JMS
construct that receives messages from the JMS broker. The MessageConsumer
that is created is instanced in the WebClient class which is also stored in
the HTTP session.

7. The Listener created earlier is associated with the consumer to allow for
asynchronous receipt of messages.

8. The MessageConsumer is related to the id parameter and the destination
name using the prior two maps. 

That's how a consumer is created. The only ways a consumer is destroyed in
the normal course of operation are:

1. amq.removeListener(id, destination) is invoked causing the server to
process an 'unlisten' message.

2. amq.addListener(id, destination, callback) is invoked causing the server
to process a 'listen' message. If a prior consumer was created using this
destination, it is closed. (See #5 above.)

3. If the Listener class receives an onMessageAvailable call, and the
Listener hasn't been called for 50 secs, the consumer is closed. This
appears to me to be an attempt to close those consumers who have not polled
for two cycles. I am asuming that this is the server cleaning up consumers
that are no longer needed because the browser has closed. Adding a debug
message to this section of code would be useful.

4. When the HTTP session passivates or is closed, the WebClient is closed
along with all the consumers.

Things to look for in your debug log are messages relating to the closing of
consumers. Mine looks like this:
2007-09-24 20:07:19,968 DEBUG [VMTransport ]
(he.activemq.broker.region.AbstractRegion)
Removing consumer: ID:zd7000-2475-1190676467171-2:0:1:1

I'd like to see your client-side code. Are you doing anything server-side?

-- jim


JigarP wrote:
> 
> Hi Chago,
> 
>    Ya, you are right. when _amq.js is loaded polling will start. i agree
> that that time listener will not be there but when i register my listener
> using amq.aadListener then after it should get data,rgt. so even if i have
> registered my listener i was not able to get any messages. so i think
> ajaxservlet will be removing listener at server side on the basis of the
> condition. i dont know when they remove consumer for specifit
> topic/channel from server.
> 
> which side of code u want to check. server side or javascript?
> 
> 

-- 
View this message in context: http://www.nabble.com/Able-to-send-message-to-ActiveMQ-but-Not-getting-reply-to-Client-tf4400842s2354.html#a12924311
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Able to send message to ActiveMQ but Not getting reply to Client

Posted by JigarP <ji...@gmail.com>.
Hi Chago,

   Ya, you are right. when _amq.js is loaded polling will start. i agree
that that time listener will not be there but when i register my listener
using amq.aadListener then after it should get data,rgt. so even if i have
registered my listener i was not able to get any messages. so i think
ajaxservlet will be removing listener at server side on the basis of the
condition. i dont know when they remove consumer for specifit topic/channel
from server.

which side of code u want to check. server side or javascript?

J 

chago wrote:
> 
> The polling begins as soon as the page is loaded and the _amq.js fle is
> processed. It is quite probable that their are no consumers at this time.
> A consumer isn't created until the amq.addListener() function is invoked. 
> 
> Can you post your code?
> 
> -- jim
> 
> 
> JigarP wrote:
>> 
>> Hi Chago,
>>      I had checked out whole activemq +ajax forum and i had found the
>> same issue related question posted but they where not having any reply
>> for that. I think whn polling happens then it does not have any consumer
>> so it is not goin inside for loop itself. 
>> 
>>      can you tell me if you can help me out for this. or suggest
>> alternate solution for this.
>> 
>> J
>>     
>> 
>> chago wrote:
>>> 
>>> Unfortunately, I am familiar only with the javascript client portion of
>>> the puzzle. The MessageListenerServlet itself is the entity that
>>> establishes the JMS connection with the broker. (Hope my terminology is
>>> correct there.) The servlet acts as a pass-through proxy to the
>>> javascript client. If you are seeing this servlet drop connections to
>>> the broker, it should show up using detailed logging.
>>> 
>>> Which condition in doMessages is failing?
>>>   - is there at least one consumer?
>>>   - does consumer.getAvailableListener() return a value?
>>> 
>>> In subversion, there doesn't appear to be many changes in the early part
>>> of the doMessages() method. Would you be able to include the
>>> avtivemq-web.jar file from the head in your project to replace the 4.x
>>> version. There may be other dependencies that prevent this, but I have
>>> never tried.
>>> 
>>> -- jim
>>> 
>>> -- jim
>>> 
>>> 
>>> JigarP wrote:
>>>> 
>>>> Hi Chago/James,
>>>> 
>>>>      you are right. I had same problem and because of this i am not
>>>> able to use latest tech. provided by Activemq and jetty(Continuation).
>>>> I am facing only one issue that is whenever client do polling that time
>>>> i am not getting any consumer for that client so even if we have data
>>>> in the Activemq we are not able to get it.
>>>> 
>>>> Below is my observation.
>>>> 
>>>> we found that activemq is having all the messages but AjaxServlet is
>>>> not able to get because whenever we do polling from client then it
>>>> checks for below condition in the
>>>> 
>>>> 
>>>> MessageListenerServlet.java class(inside activemq-web.jar) which is 
>>>> having below implementation.
>>>> 
>>>> 
>>>> //inside  
>>>>  doMessages method
>>>> 
>>>> for (int i = 0; message == null && i < 
>>>> consumers.size(); i++) {
>>>>                 consumer = (MessageAvailableConsumer)consumers.get(i);
>>>> 
>>>>                 if (consumer.getAvailableListener() == null) {
>>>>                     continue;
>>>> 
>>>>                 }
>>>> 
>>>> 
>>>>                 // Look for any available messages
>>>>              
>>>>    message = consumer.receiveNoWait();
>>>>                 if (LOG.isDebugEnabled()) {
>>>> 
>>>>                     LOG.debug("received " + message + " from " +
>>>> consumer);
>>>> 
>>>>                 }
>>>>             }
>>>> 
>>>> 
>>>> above implementation will read message from activemq for corresponding
>>>> consumer. but we found that 
>>>> we are not having any consumer related to client so even if we have
>>>> data in the activemq we are not
>>>> able to send that data back to client.
>>>> 
>>>> 
>>>> I dont know how to keep live consumer so that we can execute above
>>>> logic and we can get messages.
>>>> 
>>>> is this bug or do i need more configuration to resolve this isssue. 
>>>> 
>>>> 
>>>> 
>>>> J
>>>> 
>>>> chago wrote:
>>>>> 
>>>>> I know others that have had this problem running with the 4.1.x
>>>>> series. Is that the case for you?
>>>>> 
>>>>> -- jim
>>>>> 
>>>>> 
>>>>> JigarP wrote:
>>>>>> 
>>>>>> Hi ,
>>>>>> 
>>>>>>    I am using ActiveMQ/AJAX for my web based application. I have
>>>>>> integrated ajax successfully in my application but getting below
>>>>>> issue sometime.
>>>>>> 
>>>>>> 1) I send message to MQ but not getting reply to client browser but
>>>>>> other browsers are getting reply who are registered for same topic.
>>>>>> 
>>>>>> 2)  is there any way to check whether our listener is listening to
>>>>>> topic?if not connected so we can retry and connect so we will not
>>>>>> miss any message.
>>>>>> 
>>>>>> 3)  i am not able to make stable my application because of above
>>>>>> issue. can you suggest some technique for ajax with activemq so i can
>>>>>> try out.
>>>>>> 
>>>>>> awaiting your reply,
>>>>>> 
>>>>>> Jigar
>>>>>> 
>>>>> 
>>>>> 
>>>> 
>>>> 
>>> 
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Able-to-send-message-to-ActiveMQ-but-Not-getting-reply-to-Client-tf4400842s2354.html#a12913888
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Able to send message to ActiveMQ but Not getting reply to Client

Posted by chago <na...@visualxs.com>.
The polling begins as soon as the page is loaded and the _amq.js fle is
processed. It is quite probable that their are no consumers at this time. A
consumer isn't created until the amq.addListener() function is invoked. 

Can you post your code?

-- jim


JigarP wrote:
> 
> Hi Chago,
>      I had checked out whole activemq +ajax forum and i had found the same
> issue related question posted but they where not having any reply for
> that. I think whn polling happens then it does not have any consumer so it
> is not goin inside for loop itself. 
> 
>      can you tell me if you can help me out for this. or suggest alternate
> solution for this.
> 
> J
>     
> 
> chago wrote:
>> 
>> Unfortunately, I am familiar only with the javascript client portion of
>> the puzzle. The MessageListenerServlet itself is the entity that
>> establishes the JMS connection with the broker. (Hope my terminology is
>> correct there.) The servlet acts as a pass-through proxy to the
>> javascript client. If you are seeing this servlet drop connections to the
>> broker, it should show up using detailed logging.
>> 
>> Which condition in doMessages is failing?
>>   - is there at least one consumer?
>>   - does consumer.getAvailableListener() return a value?
>> 
>> In subversion, there doesn't appear to be many changes in the early part
>> of the doMessages() method. Would you be able to include the
>> avtivemq-web.jar file from the head in your project to replace the 4.x
>> version. There may be other dependencies that prevent this, but I have
>> never tried.
>> 
>> -- jim
>> 
>> -- jim
>> 
>> 
>> JigarP wrote:
>>> 
>>> Hi Chago/James,
>>> 
>>>      you are right. I had same problem and because of this i am not able
>>> to use latest tech. provided by Activemq and jetty(Continuation). I am
>>> facing only one issue that is whenever client do polling that time i am
>>> not getting any consumer for that client so even if we have data in the
>>> Activemq we are not able to get it.
>>> 
>>> Below is my observation.
>>> 
>>> we found that activemq is having all the messages but AjaxServlet is not
>>> able to get because whenever we do polling from client then it checks
>>> for below condition in the
>>> 
>>> 
>>> MessageListenerServlet.java class(inside activemq-web.jar) which is 
>>> having below implementation.
>>> 
>>> 
>>> //inside  
>>>  doMessages method
>>> 
>>> for (int i = 0; message == null && i < 
>>> consumers.size(); i++) {
>>>                 consumer = (MessageAvailableConsumer)consumers.get(i);
>>> 
>>>                 if (consumer.getAvailableListener() == null) {
>>>                     continue;
>>> 
>>>                 }
>>> 
>>> 
>>>                 // Look for any available messages
>>>              
>>>    message = consumer.receiveNoWait();
>>>                 if (LOG.isDebugEnabled()) {
>>> 
>>>                     LOG.debug("received " + message + " from " +
>>> consumer);
>>> 
>>>                 }
>>>             }
>>> 
>>> 
>>> above implementation will read message from activemq for corresponding
>>> consumer. but we found that 
>>> we are not having any consumer related to client so even if we have data
>>> in the activemq we are not
>>> able to send that data back to client.
>>> 
>>> 
>>> I dont know how to keep live consumer so that we can execute above logic
>>> and we can get messages.
>>> 
>>> is this bug or do i need more configuration to resolve this isssue. 
>>> 
>>> 
>>> 
>>> J
>>> 
>>> chago wrote:
>>>> 
>>>> I know others that have had this problem running with the 4.1.x series.
>>>> Is that the case for you?
>>>> 
>>>> -- jim
>>>> 
>>>> 
>>>> JigarP wrote:
>>>>> 
>>>>> Hi ,
>>>>> 
>>>>>    I am using ActiveMQ/AJAX for my web based application. I have
>>>>> integrated ajax successfully in my application but getting below issue
>>>>> sometime.
>>>>> 
>>>>> 1) I send message to MQ but not getting reply to client browser but
>>>>> other browsers are getting reply who are registered for same topic.
>>>>> 
>>>>> 2)  is there any way to check whether our listener is listening to
>>>>> topic?if not connected so we can retry and connect so we will not miss
>>>>> any message.
>>>>> 
>>>>> 3)  i am not able to make stable my application because of above
>>>>> issue. can you suggest some technique for ajax with activemq so i can
>>>>> try out.
>>>>> 
>>>>> awaiting your reply,
>>>>> 
>>>>> Jigar
>>>>> 
>>>> 
>>>> 
>>> 
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Able-to-send-message-to-ActiveMQ-but-Not-getting-reply-to-Client-tf4400842s2354.html#a12908636
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Able to send message to ActiveMQ but Not getting reply to Client

Posted by JigarP <ji...@gmail.com>.
Hi Chago,
     I had checked out whole activemq +ajax forum and i had found the same
issue related question posted but they where not having any reply for that.
I think whn polling happens then it does not have any consumer so it is not
goin inside for loop itself. 

     can you tell me if you can help me out for this. or suggest alternate
solution for this.

J
    

chago wrote:
> 
> Unfortunately, I am familiar only with the javascript client portion of
> the puzzle. The MessageListenerServlet itself is the entity that
> establishes the JMS connection with the broker. (Hope my terminology is
> correct there.) The servlet acts as a pass-through proxy to the javascript
> client. If you are seeing this servlet drop connections to the broker, it
> should show up using detailed logging.
> 
> Which condition in doMessages is failing?
>   - is there at least one consumer?
>   - does consumer.getAvailableListener() return a value?
> 
> In subversion, there doesn't appear to be many changes in the early part
> of the doMessages() method. Would you be able to include the
> avtivemq-web.jar file from the head in your project to replace the 4.x
> version. There may be other dependencies that prevent this, but I have
> never tried.
> 
> -- jim
> 
> -- jim
> 
> 
> JigarP wrote:
>> 
>> Hi Chago/James,
>> 
>>      you are right. I had same problem and because of this i am not able
>> to use latest tech. provided by Activemq and jetty(Continuation). I am
>> facing only one issue that is whenever client do polling that time i am
>> not getting any consumer for that client so even if we have data in the
>> Activemq we are not able to get it.
>> 
>> Below is my observation.
>> 
>> we found that activemq is having all the messages but AjaxServlet is not
>> able to get because whenever we do polling from client then it checks for
>> below condition in the
>> 
>> 
>> MessageListenerServlet.java class(inside activemq-web.jar) which is 
>> having below implementation.
>> 
>> 
>> //inside  
>>  doMessages method
>> 
>> for (int i = 0; message == null && i < 
>> consumers.size(); i++) {
>>                 consumer = (MessageAvailableConsumer)consumers.get(i);
>> 
>>                 if (consumer.getAvailableListener() == null) {
>>                     continue;
>> 
>>                 }
>> 
>> 
>>                 // Look for any available messages
>>              
>>    message = consumer.receiveNoWait();
>>                 if (LOG.isDebugEnabled()) {
>> 
>>                     LOG.debug("received " + message + " from " +
>> consumer);
>> 
>>                 }
>>             }
>> 
>> 
>> above implementation will read message from activemq for corresponding
>> consumer. but we found that 
>> we are not having any consumer related to client so even if we have data
>> in the activemq we are not
>> able to send that data back to client.
>> 
>> 
>> I dont know how to keep live consumer so that we can execute above logic
>> and we can get messages.
>> 
>> is this bug or do i need more configuration to resolve this isssue. 
>> 
>> 
>> 
>> J
>> 
>> chago wrote:
>>> 
>>> I know others that have had this problem running with the 4.1.x series.
>>> Is that the case for you?
>>> 
>>> -- jim
>>> 
>>> 
>>> JigarP wrote:
>>>> 
>>>> Hi ,
>>>> 
>>>>    I am using ActiveMQ/AJAX for my web based application. I have
>>>> integrated ajax successfully in my application but getting below issue
>>>> sometime.
>>>> 
>>>> 1) I send message to MQ but not getting reply to client browser but
>>>> other browsers are getting reply who are registered for same topic.
>>>> 
>>>> 2)  is there any way to check whether our listener is listening to
>>>> topic?if not connected so we can retry and connect so we will not miss
>>>> any message.
>>>> 
>>>> 3)  i am not able to make stable my application because of above issue.
>>>> can you suggest some technique for ajax with activemq so i can try out.
>>>> 
>>>> awaiting your reply,
>>>> 
>>>> Jigar
>>>> 
>>> 
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Able-to-send-message-to-ActiveMQ-but-Not-getting-reply-to-Client-tf4400842s2354.html#a12900021
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Able to send message to ActiveMQ but Not getting reply to Client

Posted by chago <na...@visualxs.com>.
Unfortunately, I am familiar only with the javascript client portion of the
puzzle. The MessageListenerServlet itself is the entity that establishes the
JMS connection with the broker. (Hope my terminology is correct there.) The
servlet acts as a pass-through proxy to the javascript client. If you are
seeing this servlet drop connections to the broker, it should show up using
detailed logging.

Which condition in doMessages is failing?
  - is there at least one consumer?
  - does consumer.getAvailableListener() return a value?

In subversion, there doesn't appear to be many changes in the early part of
the doMessages() method. Would you be able to include the avtivemq-web.jar
file from the head in your project to replace the 4.x version. There may be
other dependencies that prevent this, but I have never tried.

-- jim

-- jim


JigarP wrote:
> 
> Hi Chago/James,
> 
>      you are right. I had same problem and because of this i am not able
> to use latest tech. provided by Activemq and jetty(Continuation). I am
> facing only one issue that is whenever client do polling that time i am
> not getting any consumer for that client so even if we have data in the
> Activemq we are not able to get it.
> 
> Below is my observation.
> 
> we found that activemq is having all the messages but AjaxServlet is not
> able to get because whenever we do polling from client then it checks for
> below condition in the
> 
> 
> MessageListenerServlet.java class(inside activemq-web.jar) which is 
> having below implementation.
> 
> 
> //inside  
>  doMessages method
> 
> for (int i = 0; message == null && i < 
> consumers.size(); i++) {
>                 consumer = (MessageAvailableConsumer)consumers.get(i);
> 
>                 if (consumer.getAvailableListener() == null) {
>                     continue;
> 
>                 }
> 
> 
>                 // Look for any available messages
>              
>    message = consumer.receiveNoWait();
>                 if (LOG.isDebugEnabled()) {
> 
>                     LOG.debug("received " + message + " from " +
> consumer);
> 
>                 }
>             }
> 
> 
> above implementation will read message from activemq for corresponding
> consumer. but we found that 
> we are not having any consumer related to client so even if we have data
> in the activemq we are not
> able to send that data back to client.
> 
> 
> I dont know how to keep live consumer so that we can execute above logic
> and we can get messages.
> 
> is this bug or do i need more configuration to resolve this isssue. 
> 
> 
> 
> J
> 
> chago wrote:
>> 
>> I know others that have had this problem running with the 4.1.x series.
>> Is that the case for you?
>> 
>> -- jim
>> 
>> 
>> JigarP wrote:
>>> 
>>> Hi ,
>>> 
>>>    I am using ActiveMQ/AJAX for my web based application. I have
>>> integrated ajax successfully in my application but getting below issue
>>> sometime.
>>> 
>>> 1) I send message to MQ but not getting reply to client browser but
>>> other browsers are getting reply who are registered for same topic.
>>> 
>>> 2)  is there any way to check whether our listener is listening to
>>> topic?if not connected so we can retry and connect so we will not miss
>>> any message.
>>> 
>>> 3)  i am not able to make stable my application because of above issue.
>>> can you suggest some technique for ajax with activemq so i can try out.
>>> 
>>> awaiting your reply,
>>> 
>>> Jigar
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Able-to-send-message-to-ActiveMQ-but-Not-getting-reply-to-Client-tf4400842s2354.html#a12899201
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Able to send message to ActiveMQ but Not getting reply to Client

Posted by JigarP <ji...@gmail.com>.
Hi Chago/James,

     you are right. I had same problem and because of this i am not able to
use latest tech. provided by Activemq and jetty(Continuation). I am facing
only one issue that is whenever client do polling that time i am not getting
any consumer for that client so even if we have data in the Activemq we are
not able to get it.

Below is my observation.

we found that activemq is having all the messages but AjaxServlet is not
able to get because whenever we do polling from client then it checks for
below condition in the


MessageListenerServlet.java class(inside activemq-web.jar) which is 
having below implementation.


//inside  
 doMessages method

for (int i = 0; message == null && i < 
consumers.size(); i++) {
                consumer = (MessageAvailableConsumer)consumers.get(i);

                if (consumer.getAvailableListener() == null) {
                    continue;

                }


                // Look for any available messages
             
   message = consumer.receiveNoWait();
                if (LOG.isDebugEnabled()) {

                    LOG.debug("received " + message + " from " + consumer);

                }
            }


above implementation will read message from activemq for corresponding
consumer. but we found that 
we are not having any consumer related to client so even if we have data in
the activemq we are not
able to send that data back to client.


I dont know how to keep live consumer so that we can execute above logic and
we can get messages.

is this bug or do i need more configuration to resolve this isssue. 



J

chago wrote:
> 
> I know others that have had this problem running with the 4.1.x series. Is
> that the case for you?
> 
> -- jim
> 
> 
> JigarP wrote:
>> 
>> Hi ,
>> 
>>    I am using ActiveMQ/AJAX for my web based application. I have
>> integrated ajax successfully in my application but getting below issue
>> sometime.
>> 
>> 1) I send message to MQ but not getting reply to client browser but other
>> browsers are getting reply who are registered for same topic.
>> 
>> 2)  is there any way to check whether our listener is listening to
>> topic?if not connected so we can retry and connect so we will not miss
>> any message.
>> 
>> 3)  i am not able to make stable my application because of above issue.
>> can you suggest some technique for ajax with activemq so i can try out.
>> 
>> awaiting your reply,
>> 
>> Jigar
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Able-to-send-message-to-ActiveMQ-but-Not-getting-reply-to-Client-tf4400842s2354.html#a12893080
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Able to send message to ActiveMQ but Not getting reply to Client

Posted by chago <na...@visualxs.com>.
I know others that have had this problem running with the 4.1.x series. Is
that the case for you?

-- jim


JigarP wrote:
> 
> Hi ,
> 
>    I am using ActiveMQ/AJAX for my web based application. I have
> integrated ajax successfully in my application but getting below issue
> sometime.
> 
> 1) I send message to MQ but not getting reply to client browser but other
> browsers are getting reply who are registered for same topic.
> 
> 2)  is there any way to check whether our listener is listening to
> topic?if not connected so we can retry and connect so we will not miss any
> message.
> 
> 3)  i am not able to make stable my application because of above issue.
> can you suggest some technique for ajax with activemq so i can try out.
> 
> awaiting your reply,
> 
> Jigar
> 

-- 
View this message in context: http://www.nabble.com/Able-to-send-message-to-ActiveMQ-but-Not-getting-reply-to-Client-tf4400842s2354.html#a12881171
Sent from the ActiveMQ - User mailing list archive at Nabble.com.