Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 681874 Details for
Bug 901132
Transaction manager is not accepting uniqueID on its configuration, causing issues with recovery in clustering
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
SoakMdbWithRemoteOutQueueToContaniner1.java
SoakMdbWithRemoteOutQueueToContaniner1.java (text/plain), 5.02 KB, created by
Miroslav Novak
on 2012-10-30 16:31:18 UTC
(
hide
)
Description:
SoakMdbWithRemoteOutQueueToContaniner1.java
Filename:
MIME Type:
Creator:
Miroslav Novak
Created:
2012-10-30 16:31:18 UTC
Size:
5.02 KB
patch
obsolete
>package org.jboss.qa.hornetq.apps.mdb; > >import org.apache.log4j.Level; >import org.apache.log4j.Logger; > >import javax.ejb.*; >import javax.jms.*; >import javax.naming.Context; >import javax.naming.InitialContext; >import javax.naming.NamingException; >import java.io.File; >import java.io.FileInputStream; >import java.util.Properties; > >/** > * A SoakMdbWithRemoteOutQueueToContaniner1 used for lodh tests. Used in RemoteJcaTestCase. > * <p/> > * This mdb reads messages from queue "InQueue" and sends to queue "OutQueue". > * > * @author <a href="pslavice@jboss.com">Pavel Slavicek</a> > * @author <a href="mnovak@redhat.com">Miroslav Novak</a> > * @version $Revision: 1.1 $ > */ >@MessageDriven(name = "mdb", > activationConfig = { > @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"), > @ActivationConfigProperty(propertyName = "destination", propertyValue = "jms/queue/InQueue")}) >@TransactionManagement(value = TransactionManagementType.CONTAINER) >@TransactionAttribute(value = TransactionAttributeType.REQUIRED) >public class SoakMdbWithRemoteOutQueueToContaniner1 implements MessageDrivenBean, MessageListener { > > private static final long serialVersionUID = 2770941392406343837L; > private static final Logger log = Logger.getLogger(SoakMdbWithRemoteOutQueueToContaniner1.class.getName()); > private MessageDrivenContext context = null; > private static String hostname; > private static InitialContext ctx = null; > private static InitialContext ctxRemote = null; > private static Queue queue = null; > private static ConnectionFactory cf = null; > > static { > try { > Properties prop = new Properties(); > File propFile = new File(System.getProperty("jboss.home.dir") + File.separator + "mdb1.properties"); > log.info("Location of property file (mdb1) is: " + propFile.getAbsolutePath()); > prop.load(new FileInputStream(propFile)); > hostname = prop.getProperty("remote-jms-server"); > log.info("Hostname of remote jms server is: " + hostname); > final Properties env = new Properties(); > env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory"); > env.put(Context.PROVIDER_URL, "remote://" + hostname + ":4447"); > ctxRemote = new InitialContext(env); > queue = (Queue) ctxRemote.lookup("jms/queue/OutQueue"); > ctx = new InitialContext(); > // i want connection factory configured here > cf = (ConnectionFactory) ctx.lookup("java:/JmsXA"); > } catch (Exception ex) { > ex.printStackTrace(); > } > } > > public SoakMdbWithRemoteOutQueueToContaniner1() { > super(); > } > > @Override > public void setMessageDrivenContext(MessageDrivenContext ctx) { > this.context = ctx; > } > > public void ejbCreate() { > } > > @Override > public void ejbRemove() { > if (ctxRemote != null) { > try { > ctxRemote.close(); > } catch (NamingException e) { > log.log(Level.FATAL, e.getMessage(), e); > } > } > if (ctx != null) { > try { > ctx.close(); > } catch (NamingException e) { > log.log(Level.FATAL, e.getMessage(), e); > } > } > } > > @Override > public void onMessage(Message message) { > > Connection con = null; > Session session = null; > > try { > > long time = System.currentTimeMillis(); > int counter = 0; > try { > counter = message.getIntProperty("count"); > } catch (Exception e) { > log.log(Level.ERROR, e.getMessage(), e); > } > > String messageInfo = message.getJMSMessageID() + ", count:" + counter; > > con = cf.createConnection(); > > session = con.createSession(false, Session.AUTO_ACKNOWLEDGE); > > con.start(); > > String text = message.getJMSMessageID() + " processed by: " + hashCode(); > MessageProducer sender = session.createProducer(queue); > TextMessage newMessage = session.createTextMessage(text); > newMessage.setStringProperty("inMessageId", message.getJMSMessageID()); > sender.send(newMessage); > > log.log(Level.INFO, " End of " + messageInfo + " in " + (System.currentTimeMillis() - time) + " ms"); > > } catch (Exception t) { > > t.printStackTrace(); > log.log(Level.FATAL, t.getMessage(), t); > > this.context.setRollbackOnly(); > } finally { > if (session != null) { > try { > session.close(); > } catch (JMSException e) { > log.log(Level.FATAL, e.getMessage(), e); > } > } > if (con != null) { > try { > con.close(); > } catch (JMSException e) { > log.log(Level.FATAL, e.getMessage(), e); > } > } > > > } > } >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 901132
:
681872
|
681873
| 681874 |
681875
|
681876
|
681877
|
681878
|
681879