import java.util.Hashtable; | |
import javax.jms.Connection; | |
import javax.jms.ConnectionFactory; | |
import javax.jms.JMSException; | |
import javax.jms.Message; | |
import javax.jms.MessageProducer; | |
import javax.jms.Session; | |
import javax.jms.Topic; | |
import javax.naming.Context; | |
import javax.naming.InitialContext; | |
import javax.naming.NamingException; | |
public class HelloUMJNDI { | |
public static void main(String[] args) throws NamingException, JMSException { | |
Hashtable<String, String> env = new Hashtable<>(); | |
env.put(Context.INITIAL_CONTEXT_FACTORY, | |
"com.pcbsys.nirvana.nSpace.NirvanaContextFactory"); | |
env.put(Context.PROVIDER_URL, "nsp://local-dev:9000"); | |
Context ctx = new InitialContext(env); | |
ConnectionFactory connFactory = (ConnectionFactory) ctx.lookup("local_um"); | |
Connection conn = connFactory.createConnection(); | |
Topic topic = (Topic) ctx.lookup("externalClientTopic"); | |
Session session = conn.createSession(false, Session.CLIENT_ACKNOWLEDGE); | |
MessageProducer producer = session.createProducer(topic); | |
Message message = session.createTextMessage("Hello World !"); | |
producer.send(message); | |
conn.close(); | |
ctx.close(); | |
} | |
} |
Bonjour,
Svp , est ce qu'il y a une possibilité de lister tous les queues, dans une liste . Merci de m'aider.
Connection conn = connFactory.createConnection();
asking fro typeCasting
@mmacphail
@OussamaElBergui to list all jars and topics I think you need to use directly the UM API and not the JMS API.
@yogeshdhavan
Can you clarify your question?
Jars needed :
- nClient.jar
- nJMS.jar
- jboss-jms-api_1.1_spec-1.0.1.Final.jar
I am new to UM - like just started. Where do we get these jars from? Is there any artifact repository for these jars?
@younisshah
These jar are not available in any artifact repository by default you need to add them from your org (except from the jms api).
You can find the nClient.jar
and nJMS.jar
in the UM install lib directory.
@younisshah
These jar are not available in any artifact repository by default you need to add them from your org (except from the jms api).
You can find thenClient.jar
andnJMS.jar
in the UM install lib directory.
Thank you. How does one use ActiveMQ with UM? Do you have a gist for that?
@younisshah I'm not sure what you mean :).
What are you trying to do ?
@mmacphail, i am getting an error [Root exception is com.pcbsys.nirvana.client.nSessionNotConnectedException: The session is not currently connected to the server. Unable to perform the request:Session has been closed via another thread]
.
Both threads use the same session, but it seems one thread closed the session. You want to open the session in each independent thread, or do not close the session at all in the threads and close it when the app finishes.
Jars needed :