What’s new in IBM RAD V8

Rational Application Developer for WebSphere Version 8.0 provides a simpler and streamlined way to develop Java EE 6 software, Web 2.0 rich internet applications, and Service Oriented Architecture (SOA) solutions. This release provides an integrated environment for agile developers to quickly build, test and analyze their work on the latest versions of WebSphere Application Server. Read below link for more details.

http://www.ibm.com/developerworks/wikis/display/rad/Rational+Application+Developer+Version+8.0+-+What’s+New


Thanks,
R Vashi

What’s new in IBM Webpshere V8

IBM® WebSphere® Application Server V8 is a major release that offers dramatic run time improvements, plus simpler and easier ways to develop and deploy applications.  Just wanted to share the below link which contains other major features and improvements in latest release.

http://www.ibm.com/developerworks/websphere/techjournal/1106_alcott/1106_alcott.html


Thanks,
R Vashi

Using Websphere MQ with JBoss AS 5

IBM WebSphere MQ is a family of network software products launched by IBM in March 1992. It was previously known as MQSeries, a trademark that IBM rebranded in 2002 to join the suite of WebSphere products. WebSphere MQ, which is often referred to simply as “MQ” by users, is IBM’s Message Oriented Middleware offering(JMS).

Lets see how we can configure MQ with Jboss as a pert of JMS.

Step 1: Install JBoss 5
To install JBoss AS 5, You can download it from this link http://www.jboss.org/jbossas/downloads/

Step 2: Install Webpshere MQ 7
To install visit IBM website and download a free copy of trial.

Step3: Install wmq.jmsra.rar
The copy of wmq.jmsra.rar could be found in Inside WebSphere mq install directory e.g  wmq/java/lib/jca, Also the same can be found  if you have WAS installed. Once you got this copy put it in JBOSS_HOME/server/default/deploy

Step 4: Create wmq.jmsra-ds.xml

<?xml version=”1.0″ encoding=”UTF-8″?>
<connection-factories>
<tx-connection-factory>
<jndi-name>IVTCF</jndi-name>
<xa-transaction />
<rar-name>wmq.jmsra.rar</rar-name>
<connection-definition>javax.jms.ConnectionFactory</connection-definition>
<config-property name=”channel” type=”java.lang.String”>SYSTEM.DEF.SVRCONN</config-property>
<config-property name=”hostName” type=”java.lang.String”>127.0.0.1</config-property>
<config-property name=”port” type=”java.lang.String”>1417</config-property>
<config-property name=”queueManager” type=”java.lang.String”>JBOSS_QM</config-property>
<config-property name=”transportType” type=”java.lang.String”>CLIENT</config-property>
<security-domain-and-application>JmsXARealm</security-domain-and-application>
</tx-connection-factory>
<mbean code=”org.jboss.resource.deployment.AdminObject” name=”jca.wmq:name=ivtqueue”>
<!– Bind this AdminObject with the JNDI name IVTQueue –>
<attribute name=”JNDIName”>IVTQueue</attribute>
<depends optional-attribute-name=”RARName”>jboss.jca:service=RARDeployment,name=’wmq.jmsra.rar'</depends>
<attribute name=”Type”>javax.jms.Queue</attribute>
<attribute name=”Properties”>
baseQueueManagerName=JBOSS_QM
baseQueueName=JBOSS_Q
</attribute>
</mbean>
</connection-factories>

Step 5:  Create a EJB 3.0 project in JBoss Studio or in Eclipse IDE.

Step 6: Write a Message Driven Bean

package com.sa.jms;

import java.io.ByteArrayOutputStream;

import javax.ejb.ActivationConfigProperty;
import javax.ejb.MessageDriven;
import javax.ejb.MessageDrivenBean;
import javax.ejb.MessageDrivenContext;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
import javax.jms.BytesMessage;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;

import org.jboss.ejb3.annotation.ResourceAdapter;

/**
* Message-Driven Bean implementation class for: MQJbossExample
*
*/

@MessageDriven(activationConfig = {
@ActivationConfigProperty(propertyName = “destinationType”,
propertyValue = “javax.jms.Queue”),

@ActivationConfigProperty(propertyName = “messagingType”,
propertyValue = “javax.jms.MessageListener”),

@ActivationConfigProperty(propertyName = “destination”, propertyValue = “JBOSS_Q”),

@ActivationConfigProperty(propertyName = “queueManager”, propertyValue = “JBOSS_QM”),
@ActivationConfigProperty(propertyName = “hostName”, propertyValue = “127.0.0.1”),
@ActivationConfigProperty(propertyName = “port”, propertyValue = “1417”),
@ActivationConfigProperty(propertyName = “channel”, propertyValue = “SYSTEM.DEF.SVRCONN”),

@ActivationConfigProperty(propertyName = “transportType”,propertyValue = “CLIENT”), },

messageListenerInterface = MessageListener.class)

@ResourceAdapter(“wmq.jmsra.rar”)

@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public class MQJbossExample implements MessageListener, MessageDrivenBean {

private int maxMessageLength = 50820;

private BytesMessage byteMessage = null;

private static final long serialVersionUID = 1L;

String recievedMessageFromWSMq = “”;

/**
* Default constructor.
*/
public MQJbossExample() {
// TODO Auto-generated constructor stub
}

/**
* @see MessageDrivenBean#ejbRemove()
*/
public void ejbRemove() {
// TODO Auto-generated method stub
}

/**
* @see MessageDrivenBean#setMessageDrivenContext(MessageDrivenContext)
*/
public void setMessageDrivenContext(MessageDrivenContext arg0) {
// TODO Auto-generated method stub
}

/**
* @see MessageListener#onMessage(Message)
*/
public void onMessage(Message message) {
// TODO Auto-generated method stub
try {

if (message != null) {

if (message instanceof TextMessage) {

recievedMessageFromWSMq = ((TextMessage) message).getText();
System.out.println(” recievedMessageFromWSMq ”
+ recievedMessageFromWSMq);

} else if (message instanceof BytesMessage) {

byteMessage = (BytesMessage) message;

byte[] buffer = new byte[maxMessageLength];

int byteRead;

ByteArrayOutputStream bOut = new ByteArrayOutputStream();

while ((byteRead = byteMessage.readBytes(buffer)) != -1) {

bOut.write(buffer, 0, byteRead);

}

try {

bOut.flush();

recievedMessageFromWSMq = new String(bOut.toByteArray());
System.out.println(” recievedMessageFromWSMq ”
+ recievedMessageFromWSMq);

bOut.close();

} catch (Exception e) {

e.printStackTrace();

}

}

}

} catch (JMSException e1) {

e1.printStackTrace();

}
}

}

Step 7:  Now Build the project.Start the server, If all the configuration are correct then you will see binding information of the JNDI name in the server logs, This is the first indication that Link between MQ and JBoss has successfully created.

e.g
21:13:29,812 INFO [ConnectionFactoryBindingService] Bound ConnectionManager ‘jboss.jca:service=ConnectionFactoryBinding,name=JmsXA’ to JNDI name ‘java:JmsXA’
21:13:29,984 INFO [AdminObject] Bound admin object ‘com.ibm.mq.connector.outbound.MQQueueProxy’ at ‘IVTQueue’

Step 8:  Now deploy the application on Jboss.

21:15:42,515 INFO  [EJBContainer] STARTED EJB: com.sa.jms.MQJbossExample ejbName: MQJbossExample

Step 9: Now Open Websphere MQ Explorer and put a message on the Queue.

Step 10: Once you put a dummy message on the Queue, See in the server logs to observe the message recived by our Message Driven bean.

See how simple it is to integrate Jboss with MQ. Hope this helps 🙂


Thanks
R Vashi