How to connect JMS queues from JBOSS 4 and 5? - jboss

I have a server on which a Jboss 4.2.2 and a Jboss 5.1.0 runs. The problem is that a 3rd party is not able to upgrade its application to Jboss 5.1.0 in the near future, for us it is a simple matter. Unfortunately we need to send and receive some JMS messages from the third party app running on Jboss 4.2.2.
What is the easiest way to enable the transfer of JMS messages between JbossMQ and JbossMessaging?

I think I found the solution for my problem. The JBOSS documentation has a chapter to migrate messages between JBOSS Messaging and JBOSS MQ: http://www.redhat.com/docs/en-US/JBoss_Enterprise_Application_Platform/5.0.0.BETA/html/JBoss_Messaging_User_Guide/inst-mqmessagemigration.html
I have 2 topics myTopicSend and myTopicReceive on my JBOSS 4.2 and I have 2 topics myTopicSend5 and myTopicReceive5 on JBOSS 5.1.
I wanted to bridge all messages from myTopicSend to myTopicReceive5 and from myTopicSend5 to MyTopicReceive.
Somehow the configuration didn't work at all first, but after some time of experimenting I have now the following config:
<mbean code="org.jboss.jms.jndi.JMSProviderLoader"
name="jboss.messaging:service=JMSProviderLoader,name=RemoteJBossMQProvider">
<attribute name="ProviderName">RemoteXAConnectionFactory</attribute>
<attribute name="ProviderAdapterClass">org.jboss.jms.jndi.JNDIProviderAdapter</attribute>
<attribute name="FactoryRef">XAConnectionFactory</attribute>
<attribute name="QueueFactoryRef">XAConnectionFactory</attribute>
<attribute name="TopicFactoryRef">XAConnectionFactory</attribute>
<attribute name="Properties">
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
java.naming.provider.url=127.0.0.1:1099
</attribute>
</mbean>
<mbean code="org.jboss.jms.server.bridge.BridgeService"
name="jboss.messaging:service=Bridge,name=LegayBridgeSend" xmbean-dd="xmdesc/Bridge-xmbean.xml">
<depends optional-attribute-name="SourceProviderLoader">jboss.messaging:service=JMSProviderLoader,name=RemoteJBossMQProvider</depends>
<depends optional-attribute-name="TargetProviderLoader">jboss.messaging:service=JMSProviderLoader,name=JMSProvider</depends>
<attribute name="SourceDestinationLookup">/topic/myTopicSend</attribute>
<attribute name="TargetDestinationLookup">/topic/myTopicReceive5</attribute>
<attribute name="QualityOfServiceMode">0</attribute>
<attribute name="MaxBatchSize">1</attribute>
<attribute name="MaxBatchTime">-1</attribute>
<attribute name="FailureRetryInterval">5000</attribute>
<attribute name="MaxRetries">-1</attribute>
<attribute name="AddMessageIDInHeader">false</attribute>
</mbean>
<mbean code="org.jboss.jms.server.bridge.BridgeService"
name="jboss.messaging:service=Bridge,name=LegayBridgeReceive" xmbean-dd="xmdesc/Bridge-xmbean.xml">
<depends optional-attribute-name="SourceProviderLoader">jboss.messaging:service=JMSProviderLoader,name=JMSProvider</depends>
<depends optional-attribute-name="TargetProviderLoader">jboss.messaging:service=JMSProviderLoader,name=RemoteJBossMQProvider</depends>
<attribute name="SourceDestinationLookup">/topic/myTopicSend5</attribute>
<attribute name="TargetDestinationLookup">/topic/myTopicReceive</attribute>
<attribute name="QualityOfServiceMode">0</attribute>
<attribute name="MaxBatchSize">1</attribute>
<attribute name="MaxBatchTime">-1</attribute>
<attribute name="FailureRetryInterval">5000</attribute>
<attribute name="MaxRetries">-1</attribute>
<attribute name="AddMessageIDInHeader">false</attribute>
</mbean>
A important thing I realized was, to tweak the MaxBatchSize and MaxBatchTime parameters, because I want to deliver the messages immediately to the target queue.
A description of these parameters may be found at http://www.redhat.com/docs/en-US/JBoss_Enterprise_Application_Platform/5.0.0/html/JBoss_Messaging_1.4.6/index.html

Related

Dynamics (FetchXML) - Error: Aggregates are not supported

I'm fairly new to the FetchXML / Dynamics scene so please excuse my ignorance.
Up until now I've been executing a PowerShell Script that runs a FetchXML query to obtain user most recent login dates within Dynamics.
This has been working flawlessly for about a month, but as of about a week ago the script stopped accepting my FetchXML query throwing an error saying "Aggregates are not supported".
No changes to the code have been made what so ever.
Weirdly, the exact same code worked in the UAT Dynamics environment but not in production. After a couple more days it appears that it's stopped working in the UAT environment too.
Any ideas as to why this could be occurring? I'll post the code below.
Thanks All
$xml = [string]::Format('
<?xml version="1.0" encoding="UTF-8"?>
<fetch mapping="logical" aggregate="true" version="1.0">
<entity name="audit">
<attribute name="createdon" alias="lastlogin" aggregate="max" />
<attribute name="auditid" alias="lastloginct" aggregate="count" />
<filter>
<condition attribute="operation" operator="eq" value="4" />
<condition attribute="createdon" operator="on-or-after" value="{0}" />
</filter>
<link-entity name="systemuser" from="systemuserid" to="objectid" alias="su" link-type="inner">
<filter>
<condition attribute="domainname" operator="eq" value="{1}" />
</filter>
<attribute name="fullname" alias="fullname" groupby="true" />
<attribute name="firstname" alias="FirstName" groupby="true" />
<attribute name="lastname" alias="LastName" groupby="true" />
<attribute name="domainname" alias="domainname" groupby="true" />
<attribute name="accessmode" alias="accessmode" groupby="true" />
<attribute name="isdisabled" alias="isdisabled" groupby="true" />
<attribute name="businessunitid" alias="businessunitid" groupby="true" />
<attribute name="internalemailaddress" alias="internalemailaddress" groupby="true" />
<attribute name="systemuserid" alias="ObjectID" groupby="true"/>
<attribute name="ms_provider" alias="Provider" groupby="true"/>
<attribute name="mobilephone" alias="Mobile" groupby="true"/>
</link-entity>
</entity>
</fetch>
', $date, $user.userprincipalname)

FetchXML issues with aggregate groupby on an option field

I am having issues with a FetchXML query running against Dynamics CRM 2013 (online).
When running this simple query
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false" count="5">
<entity name="activitypointer">
<attribute name="activityid" alias="activity_id" />
<attribute name="activitytypecode" alias="activity_type" />
<attribute name="ownerid" alias="owner" />
</entity>
</fetch>
I get the expected results for the activity_type column e.g. "email", "opportunityclose" etc.
But when I attempt this aggregate version of the same query
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false" aggregate="true">
<entity name="activitypointer">
<attribute name="activityid" alias="activity_count" aggregate="count" />
<attribute name="activitytypecode" alias="activity_type" groupby="true" />
<attribute name="ownerid" alias="owner" groupby="true" />
</entity>
</fetch>
I get the correct results for the activity_count and owner columns, but the "activity_type" column is populated with just "Microsoft.Xrm.Sdk.OptionSetValue" or if ran within a report "#error".
I assume this is something to do with grouping by an option field type.
Does anyone know how to resolve this issue?
You have to be very careful when it comes with nulls and grouping. Try adding a filter that excludes null values. I have verified in 2011 that it does return a valid value for Option Sets.

Problems changing the default configuration of JBoss Mail service

Right now i have to make migration of one application.
Basic configuration:
JBOSS 5.1.0 GA
Seam 2.2.0.GA
JBPM 3.2.2
RichFaces 3.3.1.GA
Hibernate 3.3.1.GA
OS: Debian/Linux
Application has been deployed on JBoss server with its own configuration.
On old machine there was postfix (localhost, port 25) for sending messages.
On new machine i have different host and port.
What i have now in components.xml:
<mail:mail-session session-jndi-name="java:/Mail" />
My mail-service.xml:
<mbean code="org.jboss.mail.MailService"
name="jboss:service=Mail">
<attribute name="JNDIName">java:/Mail</attribute>
<attribute name="User">XXX</attribute>
<attribute name="Password">XXX</attribute>
<attribute name="Configuration">
<!-- A test configuration -->
<configuration>
<!-- Change to your mail server prototocol -->
<property name="mail.store.protocol" value="pop3"/>
<property name="mail.transport.protocol" value="smtp"/>
<!-- Change to the user who will receive mail -->
<property name="mail.user" value="XXX"/>
<!-- Change to the mail server -->
<property name="mail.pop3.host" value="localhost"/>
<!-- Change to the SMTP gateway server -->
<property name="mail.smtp.host" value="XXX"/>
<property name="mail.smtp.auth" value="true"></property>
<property name="mail.smtp.ssl.enable" value="false"></property>
<property name="mail.smtp.port" value="587"/>
<property name="mail.smtp.connectiontimeout" value="20000"></property>
<property name="mail.smtp.timeout" value="20000"></property>
<!-- The mail server port -->
<!-- Change to the address mail will be from -->
<property name="mail.from" value="XXX"/>
<!-- Enable debugging output from the javamail classes -->
<property name="mail.debug" value="true"/>
</configuration>
</attribute>
<depends>jboss:service=Naming</depends>
I'm intrested only in sending messages.
But still:
javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25;
nested exception is:
java.net.ConnectException: Connection refused
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1282)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:370)
at javax.mail.Service.connect(Service.java:275)
at javax.mail.Service.connect(Service.java:156)
at javax.mail.Service.connect(Service.java:105)
at javax.mail.Transport.send0(Transport.java:168)
at javax.mail.Transport.send(Transport.java:98)
<xxx>
Caused by: java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:529)
at java.net.Socket.connect(Socket.java:478)
at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:232)
at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:189)
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1250)
... 59 more
Of course connection is refused because application is still pointed on localhost:25.
I have tried to find with grep other configurations, allocations, etc. mail-service is started (jmx-console info). Still its looked like aplication is not configured properly but using defaults.. Whats wrong?
PS: I'm not specialist in JBoss. I don't have root account on this hosting server.

Jboss Service depending on JNDI resource

I have written a Jboss4 MBean which relies on other JNDI resource named XAOracleDS and defined in an xml datasource file (*-ds.xml). But when I restart my JBoss instance, I have a
javax.naming.NameNotFoundException: XAOracleDS not bound
due to the implementation of my service. I tried to fix this by updating my jboss-service.xml file adding a dependency to the Jboss naming service
...
<depends>jboss:service=Naming</depends>
...
, but it didn't work.
Here is my jboss-service.xml
<server>
<classpath codebase="lib" archives="scheduler-plugin.jar" />
<mbean code="org.jboss.varia.scheduler.Scheduler" name="DefaultDomain:service=MigrationScheduler">
<attribute name="StartAtStartup">true</attribute>
<attribute name="SchedulableClass">MyScheduler</attribute>
<attribute name="InitialStartDate">NOW</attribute>
<attribute name="InitialRepetitions">1</attribute>
<attribute name="SchedulePeriod">1000</attribute>
<depends>jboss:service=Naming</depends>
</mbean>
Does anyone have an idea of what's wrong?
I ran into a similar issue a while back and not 100% sure whether it applies to you. Found that the files are deployed alphabetically. So try renaming your *-ds.xml files with say abc-ds.xml and see if it helps.

JbossESB jmsProvider cannot convert IBMMQ JMS Message JMSTextMessage

I am trying to integrate IBMMQ v6.0.2 with jbossESB.
we have local Queue available on IBMMQ on one of our QA QUEUEMANAGER.
I am able to listen to the QUEUE using JMSprovider of jboss ESB. As soon as a message (of type jms_text ) is dropped , esb listen to it and pick it up and before it hit the next action it throws following error message.
ERROR [JmsComposer] Unsupported JMS message type: com.ibm.jms.JMSTextMessage
Here are the steps I followed.
jboss-service.mxl : Defined Connection Factory and QUEUE
added jars ( com.ibm.mq.* ) to ${jbossesb}/server/${mynode}/lib
Added jms lsinterner configuration on jboss-esb.xml
Please guide me what I m missing here... Do I need to create custom MessagePlugin ?
jboss-esb looks like this
<jms-provider name="WSMQ" connection-factory="MQQueueConnectionFactory">
<jms-bus busid="queuestartGwChannel"> <jms-message-filter
dest-type="QUEUE"
dest-name="wsmq/SerivceOrderQueue"
acknowledge-mode ="AUTO_ACKNOWLEDGE"
/>
</jms-bus>
<jms-bus busid="queuestartEsbChannel">
<jms-message-filter
dest-type="QUEUE"
dest-name="wsmq/SerivceOrderQueue"
/>
</jms-bus>
</jms-provider>
jboss-service.xml looks like this
<mbean code="jmx.service.wsmq.WSMQConnectionFactory"
name="jmx.service.wsmq:service=MQQueueConnectionFactory">
<attribute name="JndiName">MQQueueConnectionFactory</attribute>
<attribute name="JMSStyle">Queue</attribute>
<attribute name="IsXA">false</attribute>
<attribute name="QueueManagerName">SQAT0083</attribute>
<attribute name="HostName">111.111.111.111</attribute>
<attribute name="Port">1415</attribute>
<attribute name="Channel">MYCO.SVRCONN</attribute>
<attribute name="TransportType">CLIENT</attribute>
<depends>jboss:service=Naming</depends>
</mbean>
<mbean code="jmx.service.wsmq.WSMQDestination"
name="jmx.service.wsmq:service=WSMQRequestQueue">
<attribute name="JndiName">wsmq/SerivceOrderQueue</attribute>
<attribute name="JMSStyle">Queue</attribute>
<attribute name="QueueManagerName">SQAT0083</attribute>
<attribute name="DestinationName">MYCO.SERVICEORDER.QA01.QL01</attribute>
<attribute name="TargetClient">MQ</attribute>
<depends>jboss:service=Naming</depends>
</mbean>
I am using jboss-eap-4.3. Really appreciate any help.
Here is my Service Tag Looks like in jboss-esb.xml
<listeners>
<jms-listener name="MQ-Gateway"
busidref="queuestartGwChannel"
is-gateway="true" maxThreads="1"
/>
<jms-listener name="MQ-EsbListener" busidref="queuestartEsbChannel" />
</listeners>
<actions mep="OneWay">
<action name="serviceOrderMarshaller"
class="com.my.esb.actions.ServiceOrderMessageUnMarshallerAction"
process="unmarshalPayload">
<property name="springContextXml" value="spring/mainApplicationContext.xml"/>
</action>
<action name="serviceOrderStaging"
class="com.my.esb.actions.ServiceOrdersStagingAction"
process="stageServiceOrders">
<property name="springContextXml" value="spring/mainApplicationContext.xml"/>
</action>
<action name="marginAndLeadTimeRetriever"
class="com.my.esb.actions.MarginAndLeadTimeRetrieverAction"
process="retrieveJobCodeInfo">
<property name="springContextXml" value="spring/mainApplicationContext.xml"/>
</action>
<action name="createDraftRequestMapper"
class="com.my.esb.actions.CreateDraftRequestMapperAction"
process="mapData">
<property name="springContextXml" value="spring/mainApplicationContext.xml"/>
</action>
<action name="omsCreateDraftRequestTranslator"
class="com.my.esb.actions.OMSCreateDraftRequestTranslatorAction"
process="translateData">
<property name="springContextXml" value="spring/mainApplicationContext.xml"/>
</action>
<action name="createDraftRequestProcessor"
class="com.my.esb.actions.CreateDraftRequestProcessorAction"
process="dispatchRequest">
<property name="springContextXml" value="spring/mainApplicationContext.xml"/>
</action>
</actions>
Bit late response but if someone reads this, the answer is:
queuestartEsbChannel is listening to the same queue that is delivering jmstextmessages and it has is-gateway set to false (default value).
If is-gateway is false, only ESB messages can be recieved on that listener.
I would have expected to see com.ibm.mqjms.jar in the CLASSPATH for a JMS app, not com.ibm.mq.*.
Depending on the version of WMQ you are using, please reference the Environment Variables page in the Infocenter. WMQ V6 page is here (see Table #2), and the WMQ v7 page is here (see the table and the notes below). Note that the classes have been repackaged between versions and the CLASSPATH requirements are quite different.
On UNIX flavors, you can run the setmqjms script to configure the environment for WMQ JMS. It lives in /opt/mqm/java/bin or /usr/mqm/java/bin on AIX. This assumes a standard WMQ client installation, though. If you just grabbed the jars and relocated them, it won't work. In particular, if you just grabbed the com.ibm.mq* jars it likely won't work. You can verify your installation by running the Initial Verification Test (IVT) supplied with the client install. The additional benefit of using a full WMQ client is that all of the trace utilities and sample code and other diagnostics are installed.
One other piece of advice, be sure to use the WMQ v7 client even if the WMQ server is at v6. This is because WMQ v6 is going out of service next year and will not be supported after that. Using the v7 client now will save you a migration later, CLASSPATH changes, etc. In addition, the v7 classes have lots of cool new features when used with a v7 QMgr such as automatic client reconnection to the same or different QMgr, depending on your configuration. The WMQ client install is a free download (registration required) as SupportPac MQC7.