Re: activemq architecture with jboss

2006-08-17 Thread James Strachan

On 8/16/06, masien [EMAIL PROTECTED] wrote:


Hi all,
Execuse me but i am new in JMS and ActiveMQ...
I'd like to create an architecture with a client that send messages to 2
brokers (in cluster) and a MDB that consume the messages.
Must I use JBOSS for use MDB?


MDBs are supported by all J2EE application servers so you can take
your pick there.

Also there are Message Driven POJOs if you don't want to go the J2EE route

http://jencks.org/Message+Driven+POJOs



In this case, must i have two instance of Jboss in order to avoid the single
point of failure?
That is a good road???
Help me...it is very important.


Whether you use 1 broker or 2 in a cluster - I recommend running
multiple JVMs preferably on different boxes of the JMS clients (the
producers and consumers). Whether you use Tomcat or JBoss or just a
regular JVM is your call, whatever you are comfortable with.

--

James
---
http://radio.weblogs.com/0112098/


Re: activemq architecture with jboss

2006-08-17 Thread masien

When I configure two instance of JBOSS...must to point each instance to each
ActiveMQ broker ?

P.S.
The client producer is on another jvm and it send messages to brokers that
are on other two virtual machine.

Max
-- 
View this message in context: 
http://www.nabble.com/activemq-architecture-with-jboss-tf2118066.html#a5848392
Sent from the ActiveMQ - Dev forum at Nabble.com.



Re: activemq architecture with jboss

2006-08-17 Thread James Strachan

On 8/17/06, masien [EMAIL PROTECTED] wrote:


When I configure two instance of JBOSS...must to point each instance to each
ActiveMQ broker ?

P.S.
The client producer is on another jvm and it send messages to brokers that
are on other two virtual machine.


If you have 2 JBoss servers hosting MDBs then you might as well just
run a single ActveMQ broker separately and have everyone talk to the
same broker for simplicity. If you want full HA you might then
consider running that broker as a pair of master/slaves.

http://incubator.apache.org/activemq/masterslave.html

--

James
---
http://radio.weblogs.com/0112098/


Re: Queue hogging by a single consumer.

2006-08-17 Thread Naveen Rawat
Hi James, 

Thanks for your response. 



Are you trying to implement request-response with A, B, C making 
requests on Z and getting the response? Or can A, B, C process any 
message from Z? 



Exactly the first case.
A, B, C making requests on Z and getting the response from Z 




I'm not sure if your issue is that say A doesn't see the responses for 
its request (if thats the case use either 3 queues, use temporary 
queues for the responses or use a selector and a correlationID on the 
request  response) - or is it that you have a small number of 
responses from Z and they are being hogged by one consumer - in which 
case setting a small prefetch and a round robin dispatch policy will 
fix this. 



Its that,  A doesn't see the responses for its requests made. 


I would really appreciate if I can get some help stuff on -
1) Creating, destroying and maintaining data in temporary queues.
	2) Setting selector and correlationID in messages. 




On 8/17/06, Naveen Rawat [EMAIL PROTECTED] wrote: 
 
 Hi all :) 
 
 I am working with the binary version of ActiveMQ 4.0 broker and trying out 
 the openwire cpp apis for asynchronous messaging. 
 [https://svn.apache.org/repos/asf/incubator/activemq/tags/activemq-4.0/openw 
 ire-cpp] 
 
 
 
 I wonder if I m resurrecting the mummies of issues already burnt. 
 
 
 
 I am trying out having 3 consumers A, B and C listening on the same queue. 
 What I am trying to do is - 
 
 A, B, C sending on Q1, and consuming Z's response on Q2 
 Consumer Z listening on Q1, responding back on Q2. 
 
 like this - 
 A/B/CQ1ZQ2A/B/C 
 
 
 Listening/responding to a single consumer is working well at present. BUT 
 broker is spoofing up the responses from Z to the simultaneous consumers 
 (either 2 or all three). Response for one consumer (A) is going to any of 
 the other consumer (B/C). Same is happening for other consumers. Being 
 prefetch size preset to 1000, the consumer that first manages session with 
 the broker on a queue is getting all the messages (and if it gets 
 terminated, the following one hogs the all and so on.) . 
 
 As I m at presently testing, setting prefetch size to less (say 1), even 
 dont solves the purpose as not giving it frequest quick requests (man Vs 
 machine). Moreover as the hogging consumer is reading and acknowledging all 
 the responses, the prefetch size of even 1 is not surpassed. 
 
 I tried out with no success the way of grid processing of messages (using 
 MessageGroups) as suggested in 
 http://activemq.org/site/how-do-i-preserve-order-of-messages.html 
 Code relevant of this is as follows - 
 
 [A/B/C 
 producer = session-createProducer(Q1) ; 
 producer-setPersistent(true) ; 
 message = session-createBytesMessage() ; 
 message-setJMSXGroupID(cheese) ; 
 message-writeString(Hello World) ; 
 producer-send(message); 
 .] 
 
 
 [ .Z ' s OnMessage(message)... 
 pstring NGid; 
 NGid = message-getJMSXGroupID(); 
 producer = session-createProducer(Q2) ; 
 producer-setPersistent(true) ; 
 reqMessage = session-createBytesMessage() ; 
 reqMessage-setJMSXGroupID(NGid-c_str() ); 
 reqMessage-writeString(R E C E I V E D) ;//response string 
 producer-send(reqMessage); 
 .] 
 
 Is there anymore needed in the code that I m loosing? 
 
 
 I come to know that there are certain issues yet not resolved pertaining to 
 the prefetch buffer initial size. Correct me please. 
 Will manipulation of prefetch buffer size help my cause? Please suggest a 
 way otherwise. 
 



THANKS IN ADVANCE

Regards,
Navin



Re: Queue hogging by a single consumer.

2006-08-17 Thread James Strachan

On 8/17/06, Naveen Rawat [EMAIL PROTECTED] wrote:

Hi James,

Thanks for your response.


 Are you trying to implement request-response with A, B, C making
 requests on Z and getting the response? Or can A, B, C process any
 message from Z?


Exactly the first case.
A, B, C making requests on Z and getting the response from Z



 I'm not sure if your issue is that say A doesn't see the responses for
 its request (if thats the case use either 3 queues, use temporary
 queues for the responses or use a selector and a correlationID on the
 request  response) - or is it that you have a small number of
 responses from Z and they are being hogged by one consumer - in which
 case setting a small prefetch and a round robin dispatch policy will
 fix this.


Its that,  A doesn't see the responses for its requests made.

I would really appreciate if I can get some help stuff on -
1) Creating, destroying and maintaining data in temporary queues.
2) Setting selector and correlationID in messages.


Details here

http://incubator.apache.org/activemq/how-should-i-implement-request-response-with-jms.html

for 1) just call session.createTemporaryQueue() and set that queue on
the Message.setJMSReplyTo() property so that services can reply to
your temporary queue. They are deleted when A terminates so there's no
issue with maintaining data.

for 2) just add a JMSCorrelationID() to the request messages you send
as requests. You can then use a selector such as JMSCorrelationID =
'abc' on the consumer for responses so that responses are filtered to
only return A's results etc

The contract of Z whichever option you go with is the to copy the
JMSCorrelationID property from the request to the response message and
send the response message to the request.getJMSReployTo() destination

--

James
---
http://radio.weblogs.com/0112098/


Re: Queue hogging by a single consumer.

2006-08-17 Thread Naveen Rawat
Thanks James. 

Thanks for the response 

I will try out your suggestions and get back to you soon. 

 Hi James, 
 
 Thanks for your response. 
 
 
  Are you trying to implement request-response with A, B, C making 
  requests on Z and getting the response? Or can A, B, C process any 
  message from Z? 
 
 
 Exactly the first case. 
 A, B, C making requests on Z and getting the response from Z 
 
 
 
  I'm not sure if your issue is that say A doesn't see the responses for 
  its request (if thats the case use either 3 queues, use temporary 
  queues for the responses or use a selector and a correlationID on the 
  request  response) - or is it that you have a small number of 
  responses from Z and they are being hogged by one consumer - in which 
  case setting a small prefetch and a round robin dispatch policy will 
  fix this. 
 
 
 Its that,  A doesn't see the responses for its requests made. 
 
 I would really appreciate if I can get some help stuff on - 
 1) Creating, destroying and maintaining data in temporary queues. 
 2) Setting selector and correlationID in messages.  

Details here  

http://incubator.apache.org/activemq/how-should-i-implement-request-response-with-jms.html  

for 1) just call session.createTemporaryQueue() and set that queue on 
the Message.setJMSReplyTo() property so that services can reply to 
your temporary queue. They are deleted when A terminates so there's no 
issue with maintaining data.  

for 2) just add a JMSCorrelationID() to the request messages you send 
as requests. You can then use a selector such as JMSCorrelationID = 
'abc' on the consumer for responses so that responses are filtered to 
only return A's results etc  

The contract of Z whichever option you go with is the to copy the 
JMSCorrelationID property from the request to the response message and 
send the response message to the request.getJMSReployTo() destination 





Regards,
Navin


RE: How To remove Queue from the session

2006-08-17 Thread Bish, Tim
  I am working on openwire-cpp ( for ActiveMQ-4.0) code on SuSe(Linux
  machine-i686-suse-linux, version 2.6.13-15.8-default), in C++ .
  How to remove/deattached a queue from the session without closeing
 connection from the sender/reveiver side?. is it possible?

Close the Consumer or Producer and delete it would be my guess.

-
Timothy A. Bish
Sensis Corporation
- 



 -Original Message-
 From: Arshad Ahamad [mailto:[EMAIL PROTECTED]
 Sent: Thursday, August 17, 2006 7:36 AM
 To: activemq-dev@geronimo.apache.org;
activemq-users@geronimo.apache.org
 Subject: How To remove Queue from the session
 
 
 Hi all,
 
 
 
 
 
  Thanks
  Arashad Ahamad


How To remove Queue from the session

2006-08-17 Thread Arshad Ahamad


Hi all, 


I am working on openwire-cpp ( for ActiveMQ-4.0) code on SuSe(Linux
machine-i686-suse-linux, version 2.6.13-15.8-default), in C++ .
How to remove/deattached a queue from the session without closeing 
connection from the sender/reveiver side?. is it possible? 





Thanks
Arashad Ahamad


Re: How To remove Queue from the session

2006-08-17 Thread Arshad Ahamad

Hi Bish,

  When I use session-close() API then the following error comes up..
[FAILED]
 Message content has been corrupted 


and this does not remove the queue from the receiver side
is there any other API for that please tell me. 

 I am working on openwire-cpp ( for ActiveMQ-4.0) code on SuSe(Linux 
machine-i686-suse-linux, version 2.6.13-15.8-default), in C++ . 
 How to remove/deattached a queue from the session without closeing 
connection from the sender/reveiver side?. is it possible? 


Close the Consumer or Producer and delete it would be my guess. 
  How to close consumer/producer(what is the API)? 



Thanks
Arashad Ahamad


[jira] Created: (AMQ-882) TopicPublisher.publish(topicSession.createTextMessage(Hello World) hangs and throws a JMSException

2006-08-17 Thread Kai Pruente (JIRA)
TopicPublisher.publish(topicSession.createTextMessage(Hello World) hangs and 
throws a JMSException


 Key: AMQ-882
 URL: https://issues.apache.org/activemq/browse/AMQ-882
 Project: ActiveMQ
  Issue Type: Bug
  Components: Transport
Affects Versions: 4.0.1
 Environment: Server: Suse Linux 2.6.5-7.244-smp, JDK  1.5.0_07
Client: Windows XP SP2, JDK  1.5.0_06

Reporter: Kai Pruente


Scenario:
ActiveMQ and the publisher process running on the same server.
Several clients are running on several Windows-XP clients

Publisher code:
{code}
// initializing
connection = msgFactory.createTopicConnection();
connection.setExceptionListener(new JMSExceptionListener());
connection.start();

topicSession = connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
topic = topicSession.createTopic(MFS_LOCATION_CHANGE_EVENT_TOPIC);

publisher = topicSession.createPublisher(topic);
publisher.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
[...]
// sending several times with the same topic
try {
  publisher.publish(topicSession.createTextMessage(location.getName()));
} catch (JMSException e) {
  log.fatal(Problems during informing Workplace topic: + location.getName(), 
e);
  [...]
{code}

Subscriber code:
{code}
topicConnection = msgFactory.createTopicConnection();
topicConnection.start();
topicConnection.setExceptionListener(new JMSExceptionListener(listeners, this));

topicSession = topicConnection.createTopicSession(false, 
Session.AUTO_ACKNOWLEDGE);
Topic topic = 
topicSession.createTopic(EventSender.MFS_LOCATION_CHANGE_EVENT_TOPIC);

topicSubscriber = topicSession.createSubscriber(topic);
topicSubscriber.setMessageListener(new MessageListener() {
public void onMessage(Message message) {
  if (message instanceof TextMessage) {
[...]
  topicConnection.start();
{code}

After some thound of messages publish hangs for more than 1 minute and then 
throws a JMSException (see logs below). After searching in ActiveMQ mailing 
lists I changed the broker url of the publisher from:
* tcp://arvwms:61616
to 
* 
tcp://arvwms:61616?soTimeout=2000connectionTimeout=1socketBufferSize=1024wireFormat.maxInactivityDuration=0

This works some days fine, but now we get the exceptions again.

Is this a problem between topic publisher and ActiveMQ or could it be also a 
problem between ActiveMQ and topic subscriber? If it is real a problem between 
publisher and ActiveMQ it can't be a network problem, becuase it is the same 
server.

This problems occur about 10 times the day. With the exception and losing of 10 
messages the day I could live, but the hanging about 1 minute is terrible for 
our application.

The Exception:
{code}
DEBUG 2006-08-17 12:45:53.738 portConfirmationDefaultHandler :-: - 
handle telegram: [EMAIL 
PROTECTED],loadUnit=01900,lastLocation=SCS_CS,weight=null,orientation=0,infoType=COMPLETE,wmsID=1039340,reason=OK]
FATAL 2006-08-17 12:47:12.534 EventSender:-: - 
Problems during informing Workplace topic:SCS_CS
javax.jms.JMSException: Broken pipe
  at 
org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:57)
  at 
org.apache.activemq.ActiveMQConnection.asyncSendPacket(ActiveMQConnection.java:1094)
  at org.apache.activemq.ActiveMQSession.send(ActiveMQSession.java:1553)
  at 
org.apache.activemq.ActiveMQMessageProducer.send(ActiveMQMessageProducer.java:462)
  at 
org.apache.activemq.ActiveMQMessageProducer.send(ActiveMQMessageProducer.java:356)
  at 
org.apache.activemq.ActiveMQTopicPublisher.publish(ActiveMQTopicPublisher.java:128)
  at 
com.ssn.acx.extensions.logistics.mfsadapter.event.EventSender.sendLocationChangeEvent(EventSender.java:150)
  at 
com.ssn.acx.extensions.logistics.mfsadapter.MFSTransactionWithSendingTrigger.commit(MFSTransactionWithSendingTrigger.java:109)
  at 
com.ssn.acx.core.common.transaction.GlobalTransactionImpl.commit(GlobalTransactionImpl.java:198)
  at 
com.ssn.acx.core.common.adapterservice.TelegramDispatcher.handleTelegram(TelegramDispatcher.java:306)
  at 
com.ssn.acx.core.common.adapterservice.TelegramDispatcher.dispatch(TelegramDispatcher.java:180)
  at 
com.ssn.acx.core.common.adapterservice.AbstractCollector.dispatch(AbstractCollector.java:81)
  at 
com.ssn.acx.api.common.adapterservice.TriggeredCollector.dispatch(TriggeredCollector.java:87)
  at 
com.ssn.acx.core.logistics.mfsadapter.MFSCollector.collectTelegrams(MFSCollector.java:122)
  at 
com.ssn.acx.core.logistics.mfsadapter.WakeUpListener.run(WakeUpListener.java:142)
  at java.lang.Thread.run(Thread.java:595)
Caused by: java.net.SocketException: Broken pipe
  at java.net.SocketOutputStream.socketWrite0(Native Method)
  at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
  at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
  at 

RE: How To remove Queue from the session

2006-08-17 Thread Bish, Tim
When I use session-close() API then the following error comes
up..
 [FAILED]
   Message content has been corrupted

Sounds like a possible bug in the openwire-cpp code.  IF you can write a
small test app that demonstrates the problem you could submit an issue
and hopefully the openwire-cpp guys can take a look at it.

 
 and this does not remove the queue from the receiver side
 is there any other API for that please tell me.

-
Timothy A. Bish
Sensis Corporation
- 



 -Original Message-
 From: Arshad Ahamad [mailto:[EMAIL PROTECTED]
 Sent: Thursday, August 17, 2006 8:02 AM
 To: activemq-dev@geronimo.apache.org;
activemq-users@geronimo.apache.org
 Subject: Re: How To remove Queue from the session
 
 Hi Bish,
 
When I use session-close() API then the following error comes
up..
 [FAILED]
   Message content has been corrupted
 
 and this does not remove the queue from the receiver side
 is there any other API for that please tell me.
 
   I am working on openwire-cpp ( for ActiveMQ-4.0) code on
SuSe(Linux
  machine-i686-suse-linux, version 2.6.13-15.8-default), in C++ .
   How to remove/deattached a queue from the session without closeing
  connection from the sender/reveiver side?. is it possible?
 
 Close the Consumer or Producer and delete it would be my guess.
How to close consumer/producer(what is the API)?
 
 
  Thanks
  Arashad Ahamad


Re: How To remove Queue from the session

2006-08-17 Thread James Strachan

On 8/17/06, Arshad Ahamad [EMAIL PROTECTED] wrote:

Hi Bish,

   No no. I am not talking about the temporary queue, I am asking about
the nameing queue.


I don't follow what you're asking. FWIW queues only really exist on
the broker (they are not really associated with a client or session).
The only way to remove queues is via JMX on the broker
--

James
---
http://radio.weblogs.com/0112098/


Re: Queue hogging by a single consumer.

2006-08-17 Thread James Strachan

On 8/17/06, Naveen Rawat [EMAIL PROTECTED] wrote:

Great James
Your suggestion is working. A major hurdle seems solved.
A little query down there.



  Hi James,
 
  Thanks for your response.
 
 
   Are you trying to implement request-response with A, B, C making
   requests on Z and getting the response? Or can A, B, C process any
   message from Z?
 
 
  Exactly the first case.
  A, B, C making requests on Z and getting the response from Z
 
 
 
   I'm not sure if your issue is that say A doesn't see the responses for
   its request (if thats the case use either 3 queues, use temporary
   queues for the responses or use a selector and a correlationID on the
   request  response) - or is it that you have a small number of
   responses from Z and they are being hogged by one consumer - in which
   case setting a small prefetch and a round robin dispatch policy will
   fix this.
 
 
  Its that,  A doesn't see the responses for its requests made.
 
  I would really appreciate if I can get some help stuff on -
  1) Creating, destroying and maintaining data in temporary queues.
  2) Setting selector and correlationID in messages.

 Details here

 
http://incubator.apache.org/activemq/how-should-i-implement-request-response-with-jms.html

 for 1) just call session.createTemporaryQueue() and set that queue on
 the Message.setJMSReplyTo() property so that services can reply to
 your temporary queue. They are deleted when A terminates so there's no
 issue with maintaining data.

 for 2) just add a JMSCorrelationID() to the request messages you send
 as requests. You can then use a selector such as JMSCorrelationID =
 'abc' on the consumer for responses so that responses are filtered to
 only return A's results etc


I went for this (2nd) one. Even though now a result is obtained, I would
like to ask which one approach is more favoured by you.
Is it the temporary queues overhead matter that makes 2nd score over 1st?
Any other reason please tell.


The main difference is, do you want the response to be persistent.
e.g. if A dies and comes back again later - do you want it to resume
processing old results? In which case use a persistent queue and
correlation IDs. If the responses are transient then use a temporary
queue so the old messages get discarded by the broker when A dies.


--

James
---
http://radio.weblogs.com/0112098/


[jira] Commented: (AMQ-865) C# Client's Listener doesn't receive messages if you don't explicitly call Subscribe

2006-08-17 Thread james strachan (JIRA)
[ 
https://issues.apache.org/activemq/browse/AMQ-865?page=comments#action_36801 ] 

james strachan commented on AMQ-865:


Here's another test case which seems to show a similar issue...
http://www.nabble.com/Durable-topic-subscription-needs-pump-primed.-tf2117517.html#a5852831

using System;
using System.Collections.Generic;
using System.Text;

using NUnit.Framework;
using NUnit.Extensions;
using ActiveMQ;
using NMS;
using ActiveMQ.Commands;
using System.Threading;

namespace ActiveMQDurableTest
{
   [TestFixture]
   public class DurableTest
   {
   private static string TOPIC = TestTopic;

   private static String URI = tcp://localhost:61616;

   private static String CLIENT_ID = DurableClientId;

   private static String CONSUMER_ID = ConsumerId;

   private static ConnectionFactory FACTORY = new ConnectionFactory(new
Uri(URI));

   private int count = 0;

   public void RegisterDurableConsumer()
   {
   using (IConnection connection = FACTORY.CreateConnection())
   {
   connection.ClientId = CLIENT_ID;
   connection.Start();

   using (ISession session =
connection.CreateSession(AcknowledgementMode.DupsOkAcknowledge))
   {
   ITopic topic = session.GetTopic(TOPIC);
   IMessageConsumer consumer =
session.CreateDurableConsumer(topic, CONSUMER_ID, 2  1, false);
   consumer.Dispose();
   }

   connection.Stop();
   }
   }

   public void SendPersistentMessage()
   {
   using (IConnection connection = FACTORY.CreateConnection())
   {
   connection.Start();
   using (ISession session =
connection.CreateSession(AcknowledgementMode.DupsOkAcknowledge))
   {
   ITopic topic = session.GetTopic(TOPIC);
   ActiveMQTextMessage message = new
ActiveMQTextMessage(Hello);
   message.NMSPersistent = true;
   message.Persistent = true;

   IMessageProducer producer = session.CreateProducer();
   producer.Send(topic, message);
   producer.Dispose();
   }
   connection.Stop();
   }
   }

   [Test]
   public void TestMe()
   {
   count = 0;

   RegisterDurableConsumer();
   SendPersistentMessage();

   using (IConnection connection = FACTORY.CreateConnection())
   {
   connection.ClientId = CLIENT_ID;
   connection.Start();

   using (ISession session =
connection.CreateSession(AcknowledgementMode.DupsOkAcknowledge))
   {
   ITopic topic = session.GetTopic(TOPIC);
   IMessageConsumer consumer =
session.CreateDurableConsumer(topic, CONSUMER_ID, 2  1, false);
   consumer.Listener += new
MessageListener(consumer_Listener);

   /// Don't know how else to give the system enough time.
   ///
   Thread.Sleep(5000);

   Assert.AreEqual(0, count);

   Console.WriteLine(Count =  + count);

   SendPersistentMessage();

   Thread.Sleep(5000);

   Assert.AreEqual(2, count);

   Console.WriteLine(Count =  + count);

   consumer.Dispose();
   }

   connection.Stop();
   }
   }

   /// summary
   ///
   /// /summary
   /// param name=message/param
   private void consumer_Listener(IMessage message)
   {
   ++count;
- Hide quoted text -
   }
   }
}

 C# Client's Listener doesn't receive messages if you don't explicitly call 
 Subscribe
 

 Key: AMQ-865
 URL: https://issues.apache.org/activemq/browse/AMQ-865
 Project: ActiveMQ
  Issue Type: Bug
  Components: NMS (C# client)
 Environment: Windows XP, VS 2005, ActiveMQ 4.0.1
Reporter: Denis Abramov

  Easiest way to reproduce the bug would be to start the consumer using the 
 following code and then AFTER the consumer starts, start some producer 
 (either java or C#) and you will notice that the consumer will not get any 
 messages (through trial and error I found that calling Receive() on the 
 consumer at least once will make you lose a message but the listener will 
 kick back in): 
 using System; 
 using ActiveMQ; 
 using ActiveMQ.Commands; 
 using NMS; 
 namespace JMSClient 
 { 
 /// summary 
 /// Summary description for Class1. 
 /// /summary 
 class Class1 
 { 
 /// summary 
 /// The main entry point for the application. 
 /// /summary 
 [STAThread]