Anyone know if you can create a topic and its connection factory programmatically? Currently I use the glassfish admin utility to create my topic and its connection factory. If I can't create it in code does glassfish/openmq have a default topic and conn factory I can use?
How to create a jms Topic and TopicConnectionFactory programmatically?
7.1k Views Asked by simgineer At
1
There are 1 best solutions below
Related Questions in GLASSFISH
- Get FileNotFoundException in EAR on Glassfish
- JBoss 4.x to Glassfish 2022 and Java 6 to Java 8 causes 1 non-XA Resource Exception
- Not able to change the logging level log4j on Payara server
- GlassFish Server, deploy, null, false build-impl.xml:1072: The module has not been deployed. See the server log for details
- Glassfish 7.0.12 adds question mark to URL when running JAVA EE Application
- ModelValidationException in JAVA Jersey
- I'm not able to start jetty server
- Automating Glassfish Server during Apache Netbeans installation
- GLASSFISH CONNECTION TO DATABASE
- Glassfish JDBC Connection Pool: don't connect to MySQL
- Jaxb2RootElementHttpMessageConverter throws jakarta.xml.bind.MarshalException: null at org.glassfish.jaxb.runtime.v2.runtime.MarshallerImpl.write
- Glassfish6 WAR Module Doesn't Boot as ejb,web,webservice despite having @WebService Annotation
- What could be causing an invalid URLPatternSpec exception on glassfish 7 and how do I fix it?
- Monitoring HTTP Listeners in Glassfish 4 via JMX
- GlassFish deleted Documents
Related Questions in JMS
- Using selector with JMSMessageID always returns null
- Put JMS message properties in IBM MQ queue and access from other JMS client which run on Websphere liberty
- How to browse ActiveMQ queue using JMS selector when number of messages in queue is > 100K
- How to tell if a JMS Session is async
- ActiveMQ Artemis - Get current redelivery count for scheduled messages
- Valid value usage in JMeter's JMS Subscriber 'JMS Selector' property - in order to consume messages with a dynamically changing JMSCorrelationID
- Setting the Maximum Message Size for JMS Destinations in Payara
- ActiveMQ Artemis HA split-brain issue on OOME crash
- JMeter JMS Publisher: Getting the JMSMessageId (generated at runtime) in the header and using it as the value of another JMS Property before publish
- ActiveMQ Artemis: Muticast address deliver messages inconsistently
- ActiveMQ Artemis Consumer Connection Distribution
- ActiveMQ Artemis server produces lots of AMQ224016 error in logs after migration to Jakarta API client
- How to create a JMS queue with topic in Docker Compose?
- jakarta.jms.JMSException: Failed to build body from content. Serializable class not available to broker
- How do i stop @JmsListener from listening a queue using JmsListenerEndpointRegistry in spring boot?
Related Questions in OPENMQ
- How to recognize paused queue/broker on messageProducer.send(message)
- OpenJMS redelivers and delays messages
- How do I get OpenMQ to redeliver messages?
- Generation of binding file Message Queue Broker 4.5
- Configuring Payara/GlassFish JMS connection factory for remote connection factory
- How to give access permissions to broker in OpenMQ JMS
- How to create temporary queue and access it in JMS 2
- How does multi threading with JMS and OpenMQ in java works?
- MDB onMessage() holds the connection in case of redelivering message
- Enabling JMS MDB manually or start by delay time
- Open MQ broker won't start
- Is it possible to have JMS queue wait until it has received the acknowledgement of a message before dispatching the next message
- JMS file transfer progress
- JMS Consumer to Synchronously receive Message from Remote Producer using Glassfish and OpenMQ
- Message is lost after time out in OpenMQ
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
If you only want to circumvent creating the resources manually in the admin you can simply deploy them with the file "glassfish-resources.xml" (GF 3.1, see http://docs.oracle.com/cd/E18930_01/html/821-2417/giyhh.html).
You need an admin-object-resource like this one (for a topic):
Be aware that you must use different "Name" values for the Topic (here: "physicalTopic") if you implement multiple Topics whose messages should not get mixed up.
Further you need a connector-resource referencing a connector-connection-pool of type javax.jms.TopicConnectionFactory.
If you don't aim for dynamically creating resources using the deployment descriptor glassfish-resources.xml seems to be the best way.
Please note that resources deployed that way are application-scoped: http://docs.oracle.com/cd/E18930_01/html/821-2417/giydj.html
"glassfish-resources.xml" is the file for GF 3.x, for GF 2.x it was "sun-resources.xml". The file is located in the "Server Resources" folder in your project view if you are using NetBeans. Attention: the glassfish-resources.xml in "Server Resources" is only used by NetBeans if you use NetBeans to deploy! NetBeans knows how to create theses resources and conducts this task. If you deploy an EAR directly to Glassfish without NetBeans -- which seems very likely for a production environment -- you have to provide glassfish-resources.xml in:
You can easily create this resource definition by using NetBeans' [New Message-Driven Bean] wizard (simply add an MBean by selecting [New ...]). In the wizard choose "Project Destinations" > [Add]. A complete 3.1 example looks like this:
This is the MBean annotation:
Caution: "java:app/" in mappedName is correct only if you use application scoped resources. You can spare "java:app/" in the definition in glassfish-resources.xml. The GF deployment guide says: "Application-scoped resource JNDI names begin with java:app or java:module. If one of these prefixes is not specified in the JNDI name, it is added."
You can also introduce another level of indirection by using "name" instead of "mappedName". You then have to provide a file named "application-client.xml" where the (logical) name gets mapped to an JNDI "physical" location.