This is the code used for sending an audit message on the audit queue.

  |     public static final String CONNECTION_FACTORY_NAME = "java:/JmsXA";
  |             [...]
  | 
  |     @Resource(mappedName = AuditConstants.CONNECTION_FACTORY_NAME)
  |     private ConnectionFactory factory;
  | 
  |     @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
  |     public void finalizeAuditContext(Long auditContextId) {
  |             LOG.debug("finalizing audit context: " + auditContextId);
  |             AuditMessage auditMessage = new AuditMessage(auditContextId);
  |             try {
  |                     Connection connection = this.factory.createConnection();
  |                     try {
  |                             Session session = 
connection.createSession(true, 0);
  |                             try {
  |                                     MessageProducer producer = session
  |                                                     
.createProducer(this.auditBackendQueue);
  |                                     try {
  |                                             Message message = 
auditMessage.getJMSMessage(session);
  |                                             producer.send(message);
  |                                     } finally {
  |                                             producer.close();
  |                                     }
  |                             } finally {
  |                                     session.close();
  |                             }
  |                     } finally {
  |                             connection.close();
  |                     }
  |             } catch (JMSException e) {
  |                     this.auditAuditDAO.addAuditAudit("unable to publish 
audit context "
  |                                     + auditContextId + " - reason: " + 
e.getMessage()
  |                                     + " - errorCode: " + e.getErrorCode());
  |             }
  |     }

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4143370#4143370

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4143370
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to