Examples: query, "exact match", wildcard*, wild?ard, wild*rd
Fuzzy search: cake~ (finds cakes, bake)
Term boost: "red velvet"^4, chocolate^2
Field grouping: tags:(+work -"fun-stuff")
Escaping: Escape characters +-&|!(){}[]^"~*?:\ with \, e.g. \+
Range search: properties.timestamp:[1587729413488 TO *] (inclusive), properties.title:{A TO Z}(excluding A and Z)
Combinations: chocolate AND vanilla, chocolate OR vanilla, (chocolate OR vanilla) NOT "vanilla pudding"
Field search: properties.title:"The Title" AND text
Unanswered
How to configure Event Queues? JNDI Version

Have you asked yourself how to configure a connection with the MQ queues? I hope you will find an answer in this guide... Let's start!

This guide uses:

  • JBoss EAP/Wildfly Application Server
  • wmq.jmsra.rar adapter (for the IBM MQ queues)
  • MID 1.2.0 and above
  1. Configure the queues in your "standalone-full.xml" by defining a resource-adapter:
<subsystem xmlns="urn:jboss:domain:resource-adapters:5.0">
    <resource-adapters>
        <resource-adapter id="wmq.jmsra.rar">
            <archive>wmq.jmsra.rar</archive>
            <transaction-support>XATransaction</transaction-support>
            <connection-definitions>
                <connection-definition class-name="com.ibm.mq.connector.outbound.ManagedQueueConnectionFactoryImpl" jndi-name="java:jboss/jms/cf/NBK_QCF" enabled="true" pool-name="NBK_QCF">
                    <config-property name="hostName">SERVER_HOSTNAME_OR_IP_ADDRESS</config-property>
                    <config-property name="port">1414</config-property>
                    <config-property name="queueManager">RIQUADROQM</config-property>
                    <config-property name="channel">RIQUADRO.CH1</config-property>
                    <config-property name="transportType">CLIENT</config-property>
                    <security>
                        <application />
                    </security>
                </connection-definition>
            </connection-definitions>
            <admin-objects>
                <admin-object class-name="com.ibm.mq.connector.outbound.MQQueueProxy" jndi-name="java:jboss/jms/RIQIAQ01" pool-name="RIQIAQ01">
                    <config-property name="baseQueueName">RIQIAQ01</config-property>
                </admin-object>
            </admin-objects>
        </resource-adapter>
    </resource-adapters>
</subsystem>
  1. Open "META-INF/ejb-jar.xml" from the "mid-core-event-framework-xxx.jar" with and editor.
  2. Define your "message-driven" objects (queues) right after the "session" objects inside the "enterprise-beans" with the following code:
<message-driven>
	<ejb-name>EventReception01</ejb-name>
	<ejb-class>com.smartshaped.revo.mid.event.jms.EventReceptionMDBCMTBean</ejb-class>
	<messaging-type>javax.jms.MessageListener</messaging-type>
	<transaction-type>Container</transaction-type>
	<message-destination-type>javax.jms.Queue</message-destination-type>
	<env-entry>
		<env-entry-name>resourceID</env-entry-name>
		<env-entry-type>java.lang.String</env-entry-type>
		<env-entry-value>riquadro.ia.queue01</env-entry-value>
	</env-entry>
	<env-entry>
		<env-entry-name>producerName</env-entry-name>
		<env-entry-type>java.lang.String</env-entry-type>
		<env-entry-value>RIQUADRO</env-entry-value>
	</env-entry>
	<activation-config>
		<!-- Mandatory -->
		<activation-config-property>
			<activation-config-property-name>destinationType</activation-config-property-name>
			<activation-config-property-value>javax.jms.Queue</activation-config-property-value>
		</activation-config-property>
		<activation-config-property>
			<activation-config-property-name>destination</activation-config-property-name>
			<activation-config-property-value>java:jboss/jms/RIQIAQ01</activation-config-property-value>
		</activation-config-property>
		<!-- Not mandatory -->
		<activation-config-property>
			<activation-config-property-name>useJNDI</activation-config-property-name>
			<activation-config-property-value>true</activation-config-property-value>
		</activation-config-property>
		<activation-config-property>
			<activation-config-property-name>connectionFactoryLookup</activation-config-property-name>
			<activation-config-property-value>java:jboss/jms/cf/NBK_QCF</activation-config-property-value>
		</activation-config-property>
	</activation-config> 
</message-driven>
  1. Add in the "assembly-descriptor" section the following code FOR EACH queue defined in the previous step:
<container-transaction>
			<method>
				<ejb-name>EventReception01</ejb-name>
				<method-name>onMessage</method-name>
			</method>
			<trans-attribute>Required</trans-attribute>
		</container-transaction>
  1. Save the file and start your server.
  2. Grab a coffee while the server starts.

PS: In some cases you will need to change name of the JNDI objects and use java:/jms/ instead of java:jboss/jms/

  
  
Posted 2 years ago
Edited 2 years ago
Votes Newest

Answers