Dedicated ActiveMQ pooled ConnectionFactory with XA / JCA support

2006-12-19 Thread Guillaume Nodet

I have committed in jencks some work I have done the past weeks
on a pooled ConnectionFactory for ActiveMQ.
This add the following features:
  * multiple connections are used to improve throughput (until the
AMQ broker is multithreaded)
  * support for XA transactions: when creating a session, if an XA
transaction is active,
the session will be enlisted in this transaction
  * support for JCA : if used with JCA inbound support, there is a
need to wrap the
 XAResource so that the TM knows that both XA resources belongs to the same
 ResourceManager

Support for XA / JCA is much faster than the JCA outbound support
because the AMQ resource adapter reverts the connection in a fully clean state
after use.  This may be needed when dealing with container managed security,
but when this feature is not used, I would recommend using this pooled
connection factories, which performs much better.

--
Cheers,
Guillaume Nodet


Re: error when start broker

2006-12-19 Thread Hiram Chirino

How do you do a pessimistic lock on database record in sybase ASE 12.5??

On 12/19/06, rain.xk [EMAIL PROTECTED] wrote:


Hi,
My database is sybaseASE12.5,and I use the activemq4.1.0.
The following is the series of messages when I start broker:

- ActiveMQ 4.1.0-incubator JMS Message Broker (xuke) is starting
- For help or more information please see:
http://incubator.apache.org/activemq/
- Database driver recognized: [jconnect__tm__for_jdbc__tm_]
- Attempting to acquire the exclusive lock to become the Master broker
- Failed to acquire lock: com.sybase.jdbc3.jdbc.SybSQLException: FOR UPDATE
can not be used in a SELECT which is not part of the declaration of a cursor
or which is not a stored procedure.
com.sybase.jdbc3.jdbc.SybSQLException:  FOR UPDATE can not be used in a
SELECT which is not part of the declaration of a cursor or which is not a
stored procedure.
at com.sybase.jdbc3.tds.Tds.a(Unknown Source)
at com.sybase.jdbc3.tds.Tds.nextResult(Unknown Source)
at com.sybase.jdbc3.jdbc.ResultGetter.nextResult(Unknown Source)
at com.sybase.jdbc3.jdbc.SybStatement.nextResult(Unknown Source)
at com.sybase.jdbc3.jdbc.SybStatement.nextResult(Unknown Source)
at com.sybase.jdbc3.jdbc.SybStatement.executeLoop(Unknown Source)
at com.sybase.jdbc3.jdbc.SybStatement.execute(Unknown Source)
at com.sybase.jdbc3.jdbc.SybPreparedStatement.execute(Unknown Source)
at
org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:117)
at
org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:117)
at
org.apache.activemq.store.jdbc.DefaultDatabaseLocker.start(DefaultDatabaseLocker.java:59)

How can I handle this?
--
View this message in context: 
http://www.nabble.com/error-when-start-broker-tf2844348.html#a7942260
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.





--
Regards,
Hiram

Blog: http://hiramchirino.com


Re: Performance Issue

2006-12-19 Thread Hiram Chirino

Best bet is to run it with a profiler to figure out where the hot spot
is for linux.

On 12/18/06, garima015 [EMAIL PROTECTED] wrote:


I am facing a really bad performance of ActiveMq on linux box.
When running on windows 1000 transactions are taking 2 seconds and when
running on Linux same are taking 40 sec.
Please if anybody can tell me solution to performance issue.

Here is the code i am using to send and receive the message.

Thanks in advance

public class Requestor{
private Session session;
private Destination replyQueue;
private MessageProducer requestProducer;
private MessageConsumer replyConsumer;
Logger logger = null;

/**
 * Constructor
 */
protected Requestor() {
super();
logger = LoggerWrapper.getLogger(this.getClass().getName());
}

/**
 * This method will return the object of Requestor
 * @param connection, Connection
 * @param requestQueueName , String
 * @return  Requestor object
 * @throws JMSException
 * @throws NamingException
 */
public static Requestor newRequestor(Connection connection, String
requestQueueName)throws JMSException, NamingException {
Requestor requestor = new Requestor();
requestor.initialize(connection, requestQueueName);
return requestor;
}

/**
 * This method will initialize the Producer and Consumer on request
and reply queue
 * @param connection, Connection
 * @param requestQueueName , String
 * @throws NamingException
 * @throws JMSException
 */
protected void initialize(Connection connection, String
requestQueueName)throws NamingException, JMSException {
session = connection.createSession(false,
Session.AUTO_ACKNOWLEDGE);
Destination requestQueue =
session.createQueue(requestQueueName);

replyQueue = session.createTemporaryQueue();
requestProducer = session.createProducer(requestQueue);

requestProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
replyConsumer = session.createConsumer(replyQueue);
replyConsumer.receive(10);
}

/**
 * This method is used to send the message to queue
 * @param message
 * @throws JMSException
 */
public String send(String message) throws JMSException {
TextMessage requestMessage = (TextMessage)
session.createTextMessage();
requestMessage.setText(message);
requestMessage.setJMSReplyTo(replyQueue);
requestProducer.send(requestMessage);
return receiveSync();
}

/**
 * This method is used to receive the message from the queue
 * @return String
 * @throws JMSException
 */
private String receiveSync() throws JMSException {
TextMessage replyMessage = null;
Message msg =  replyConsumer.receive();

if (msg instanceof TextMessage){
replyMessage = (TextMessage) msg;
}
logger.debug(receive Sync:+ new Date().getTime());
return replyMessage.getText();
}
}

public class Replier implements MessageListener {

private Session session;
Logger logger = null;
Engine engineRef = null;
Transformer transformerRef = null;
MessageConsumer requestConsumer = null;
Destination replyDestination = null;
private static Map destinationMap = new HashMap();
/**
 * Constructor
 *
 */
protected Replier(){
super();
logger = LoggerWrapper.getLogger(this.getClass().getName());
}

/**
 * This will return the instance of replier
 * @param connection, Connection
 * @param requestQueueName
 * @return
 * @throws Exception
 */
public static Replier newReplier(Connection connection,String
requestQueueName ,Engine engine,Transformer transformer)throws Exception {
Replier replier = new Replier();
replier.initialize(connection,
requestQueueName,engine,transformer);
return replier;
}

/**
 * This method will initilize the consumer on request queue
 * @param connection
 * @param requestQueueName
 * @throws Exception
 */
protected void initialize(Connection connection, String
requestQueueName, Engine engine,Transformer transformer)throws Exception {
session = connection.createSession(false,
Session.AUTO_ACKNOWLEDGE);

// Create the destination (Topic or Queue)
//Destination requestQueue =
session.createQueue(requestQueueName+?consumer.retroactive=true);

Re: java.io.InterruptedIOException

2006-12-19 Thread Hiram Chirino

I would recommend that you use ActiveMQ 4.1

On 12/15/06, mar1394 [EMAIL PROTECTED] wrote:


I have just upgraded from ActiveMQ-3.2.2 to ActiveMQ-4.0 RC2.

On all my pplatforms I am getting this exeption over and over when I try to
publish:

javax.jms.JMSException: java.io.InterruptedIOException
at
org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:57)
at
org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1118)
at
org.apache.activemq.ActiveMQSession.send(ActiveMQSession.java:1524)
at
org.apache.activemq.ActiveMQMessageProducer.send(ActiveMQMessageProducer.java:462)
at
org.apache.activemq.ActiveMQMessageProducer.send(ActiveMQMessageProducer.java:384)
at
org.apache.activemq.ActiveMQTopicPublisher.publish(ActiveMQTopicPublisher.java:151)

My code is quite vanilla JMS and works with at leat 4 JMS providers.  What
is the deal here?

--
View this message in context: 
http://www.nabble.com/java.io.InterruptedIOException-tf2830293.html#a7901746
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.





--
Regards,
Hiram

Blog: http://hiramchirino.com


Re: Performance Issue

2006-12-19 Thread garima015

Thanks for the reply,but it is solved.


Hiram Chirino wrote:
 
 Best bet is to run it with a profiler to figure out where the hot spot
 is for linux.
 
 On 12/18/06, garima015 [EMAIL PROTECTED] wrote:

 I am facing a really bad performance of ActiveMq on linux box.
 When running on windows 1000 transactions are taking 2 seconds and when
 running on Linux same are taking 40 sec.
 Please if anybody can tell me solution to performance issue.

 Here is the code i am using to send and receive the message.

 Thanks in advance

 public class Requestor{
 private Session session;
 private Destination replyQueue;
 private MessageProducer requestProducer;
 private MessageConsumer replyConsumer;
 Logger logger = null;

 /**
  * Constructor
  */
 protected Requestor() {
 super();
 logger =
 LoggerWrapper.getLogger(this.getClass().getName());
 }

 /**
  * This method will return the object of Requestor
  * @param connection, Connection
  * @param requestQueueName , String
  * @return  Requestor object
  * @throws JMSException
  * @throws NamingException
  */
 public static Requestor newRequestor(Connection connection,
 String
 requestQueueName)throws JMSException, NamingException {
 Requestor requestor = new Requestor();
 requestor.initialize(connection, requestQueueName);
 return requestor;
 }

 /**
  * This method will initialize the Producer and Consumer on
 request
 and reply queue
  * @param connection, Connection
  * @param requestQueueName , String
  * @throws NamingException
  * @throws JMSException
  */
 protected void initialize(Connection connection, String
 requestQueueName)throws NamingException, JMSException {
 session = connection.createSession(false,
 Session.AUTO_ACKNOWLEDGE);
 Destination requestQueue =
 session.createQueue(requestQueueName);

 replyQueue = session.createTemporaryQueue();
 requestProducer = session.createProducer(requestQueue);

 requestProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
 replyConsumer = session.createConsumer(replyQueue);
 replyConsumer.receive(10);
 }

 /**
  * This method is used to send the message to queue
  * @param message
  * @throws JMSException
  */
 public String send(String message) throws JMSException {
 TextMessage requestMessage = (TextMessage)
 session.createTextMessage();
 requestMessage.setText(message);
 requestMessage.setJMSReplyTo(replyQueue);
 requestProducer.send(requestMessage);
 return receiveSync();
 }

 /**
  * This method is used to receive the message from the queue
  * @return String
  * @throws JMSException
  */
 private String receiveSync() throws JMSException {
 TextMessage replyMessage = null;
 Message msg =  replyConsumer.receive();

 if (msg instanceof TextMessage){
 replyMessage = (TextMessage) msg;
 }
 logger.debug(receive Sync:+ new Date().getTime());
 return replyMessage.getText();
 }
 }

 public class Replier implements MessageListener {

 private Session session;
 Logger logger = null;
 Engine engineRef = null;
 Transformer transformerRef = null;
 MessageConsumer requestConsumer = null;
 Destination replyDestination = null;
 private static Map destinationMap = new HashMap();
 /**
  * Constructor
  *
  */
 protected Replier(){
 super();
 logger =
 LoggerWrapper.getLogger(this.getClass().getName());
 }

 /**
  * This will return the instance of replier
  * @param connection, Connection
  * @param requestQueueName
  * @return
  * @throws Exception
  */
 public static Replier newReplier(Connection connection,String
 requestQueueName ,Engine engine,Transformer transformer)throws Exception
 {
 Replier replier = new Replier();
 replier.initialize(connection,
 requestQueueName,engine,transformer);
 return replier;
 }

 /**
  * This method will initilize the consumer on request queue
  * @param connection
  * @param requestQueueName
  * @throws Exception
  */
 protected void initialize(Connection connection, String
 requestQueueName, Engine engine,Transformer transformer)throws Exception
 {
 session = connection.createSession(false,
 

Re: Performance Issue

2006-12-19 Thread James Strachan

On 12/19/06, garima015 [EMAIL PROTECTED] wrote:


Thanks for the reply,but it is solved.


How did you solve it?

--

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


Board report

2006-12-19 Thread Hiram Chirino

Just noticed that we are running late submitting our board report.

I'm going to post the following as our board report:
http://wiki.apache.org/incubator/December2006?action=edit

Please add anything you think is important.

=== ActiveMQ ===

Apache ActiveMQ is a messaging broker and client.

The ActiveMQ team has put out several release since it last reported:

 - ActiveMQ 4.0.2 - was a small bug fix release.
 - ActiveMQ 4.1.0 - was a major feature enhancement release.
 - ActiveMQ CPP 1.0 - was the first release of the C++ client for ActiveMQ

We are now focusing on the next 4.1.1 bug fix release but also making
major enhancements to trunk for better scalability and that will
either be released as ActiveMQ 4.2 or 5.0.

The project has discussed graduating and feels that ActiveMQ is ready
and would prefer to become a TLP.




--
Regards,
Hiram

Blog: http://hiramchirino.com


FYI: I have uploaded new snapshots for activemq 4.1-incubator-SNAPSHOT

2006-12-19 Thread Guillaume Nodet

--
Cheers,
Guillaume Nodet


Re: error when start broker

2006-12-19 Thread rain.xk

I have not used a pessimistic lock on database record in sybase ASE 12.5. :(
Is this the sybase's defect?


Hiram Chirino wrote:
 
 How do you do a pessimistic lock on database record in sybase ASE 12.5??
 
 On 12/19/06, rain.xk [EMAIL PROTECTED] wrote:

 Hi,
 My database is sybaseASE12.5,and I use the activemq4.1.0.
 The following is the series of messages when I start broker:

 - ActiveMQ 4.1.0-incubator JMS Message Broker (xuke) is starting
 - For help or more information please see:
 http://incubator.apache.org/activemq/
 - Database driver recognized: [jconnect__tm__for_jdbc__tm_]
 - Attempting to acquire the exclusive lock to become the Master broker
 - Failed to acquire lock: com.sybase.jdbc3.jdbc.SybSQLException: FOR
 UPDATE
 can not be used in a SELECT which is not part of the declaration of a
 cursor
 or which is not a stored procedure.
 com.sybase.jdbc3.jdbc.SybSQLException:  FOR UPDATE can not be used in a
 SELECT which is not part of the declaration of a cursor or which is not a
 stored procedure.
 at com.sybase.jdbc3.tds.Tds.a(Unknown Source)
 at com.sybase.jdbc3.tds.Tds.nextResult(Unknown Source)
 at com.sybase.jdbc3.jdbc.ResultGetter.nextResult(Unknown Source)
 at com.sybase.jdbc3.jdbc.SybStatement.nextResult(Unknown Source)
 at com.sybase.jdbc3.jdbc.SybStatement.nextResult(Unknown Source)
 at com.sybase.jdbc3.jdbc.SybStatement.executeLoop(Unknown Source)
 at com.sybase.jdbc3.jdbc.SybStatement.execute(Unknown Source)
 at com.sybase.jdbc3.jdbc.SybPreparedStatement.execute(Unknown
 Source)
 at
 org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:117)
 at
 org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:117)
 at
 org.apache.activemq.store.jdbc.DefaultDatabaseLocker.start(DefaultDatabaseLocker.java:59)

 How can I handle this?
 --
 View this message in context:
 http://www.nabble.com/error-when-start-broker-tf2844348.html#a7942260
 Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.


 
 
 -- 
 Regards,
 Hiram
 
 Blog: http://hiramchirino.com
 
 

-- 
View this message in context: 
http://www.nabble.com/error-when-start-broker-tf2844348.html#a7983092
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.