tag:blogger.com,1999:blog-60443899656708174642024-02-07T00:49:45.697-08:00My Technical journeyArunhttp://www.blogger.com/profile/07140801903121620510noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-6044389965670817464.post-14576123145521567442013-04-05T09:32:00.002-07:002013-04-05T09:59:29.513-07:00OSB - OpenJMS Integration<div dir="ltr" style="text-align: left;" trbidi="on">
I have been searching for tutorials about sending message to JMS from OSB business service. Most of the examples are integration between OSB and Weblogic JMS provider. So I wanted to figure out how to configure a different JMS provider in my example OpenJMS.<br />
<br />
<b><span style="font-size: large;">Requirements:-</span></b><br />
<div style="text-align: left;">
</div>
<ul style="text-align: left;">
<li>Latest version of OpenJMS (<a href="http://openjms.sourceforge.net/downloads.html">http://openjms.sourceforge.net/downloads.html</a>.)</li>
</ul>
Our Business service will be a simple message producer. And we will use a sample Java class as a consumer.<br />
<br />
<b>Start the OpenJMS provider by running the <OpenJMS_Home>/bin/startup.bat. </b><br />
<br />
By default the OpenJMS has 2 JNDIs configured for the Connection Factory and queue. We need to create links to these objects from the Weblogic server.<br />
<br />
<b>Configuration on weblogic server:- </b><br />
<br />
<ul style="text-align: left;">
<li>Before starting the weblogic server we need to add some OpenJMS Jars to the Weblogic domain.</li>
<li>Edit the <weblogic_domain_home>/bin/setDomainEnv.bat file and at the end add</li>
<li>set CLASSPATH=%CLASSPATH%;<OpenJMS_HOME>\lib\castor-0.9.5.jar;<OpenJMS_HOME>\lib\concurrent-1.3.4.jar;<OpenJMS_HOME>\lib\openjms-0.7.7-beta-1.jar;<OpenJMS_HOME>\lib\openjms-common-0.7.7-beta-1.jar;<OpenJMS_HOME>\lib\openjms-net-0.7.7-beta-1.jar;<OpenJMS_HOME>\lib\openjms-tools-0.7.7-beta-1.jar;<OpenJMS_HOME>\lib\spice-jndikit-1.2.jar;</li>
<li>Note <b><OpenJMS_HOME></b> is the location where you have installed your OpenJMS.</li>
</ul>
<div>
<b>Configuring the OpenJMS JNDI on Weblogic</b></div>
<ul style="text-align: left;">
<li>Start your Weblogic server</li>
<li>Login into <b>Admin console</b></li>
<li>Goto <b>Services-> <a href="http://localhost:7001/console/console.portal?_nfpb=true&_pageLabel=ForeignJNDIProviderTablePage" style="background-color: white; color: #003399; font-family: Tahoma, Verdana, Helvetica, sans-serif; font-size: 11px; text-decoration: none; white-space: nowrap;" title="Foreign JNDI Providers, Level 2, 4 of 11"><img align="absbottom" alt="" border="0" id="iconForeignJNDIProviderTablePage" src="http://localhost:7001/console/images/spacer.gif" style="border: 0px;" title="Foreign JNDI Providers" /></a>Foreign JNDI Providers </b><div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjR0GhTjsUyi9FrKKyYVdokFBw49HviFZWPDsbsU7TVGkhr3F_IDloFjg7spGb2janw1viAJl0HX2YS7x8KoHyzybuTIk_NfyiHfRICXSToGRpuT5XdwMhRWzY43LZarlpzn5E2ufNVaZul/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjR0GhTjsUyi9FrKKyYVdokFBw49HviFZWPDsbsU7TVGkhr3F_IDloFjg7spGb2janw1viAJl0HX2YS7x8KoHyzybuTIk_NfyiHfRICXSToGRpuT5XdwMhRWzY43LZarlpzn5E2ufNVaZul/s1600/1.png" /></a></div>
</li>
<li>Click <b>New</b>, give a valid name and click <b>Next</b></li>
<li><b>Check </b>the target server(s) and click <b>Finish</b></li>
<li>Click on the newly created Foreign JNDI provider, Click <b>General </b>tab and enter the properties as below</li>
<ul>
<li><span style="background-color: white; font-family: Tahoma, Verdana, Helvetica, sans-serif; font-size: 11px; font-weight: bold;">Initial Context Factory: </span><span style="font-family: Tahoma, Verdana, Helvetica, sans-serif;"><span style="font-size: 11px;"><b>org.exolab.jms.jndi.InitialContextFactory</b></span></span></li>
<li><span style="font-family: Tahoma, Verdana, Helvetica, sans-serif;"><span style="font-size: 11px;"><b><span style="background-color: #f6f6f6;">Provider URL: </span>rmi://localhost:1099/</b></span></span></li>
</ul>
<li>Ignore the other 3 properties and click <b>Save</b></li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhK-9aMHGkYqF1yNdKCbezvTz1iHsA3BsR2YKPLH5ocXGEAbutXJNEhPeErgAeN4CF1I5wRxZ79ALGn0-1DAIIUqpuRzuM3o64faPhEn67U-HOVW4A5Om8YFsMun5nUDNOjZ_rxxnEqOtxa/s1600/2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="252" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhK-9aMHGkYqF1yNdKCbezvTz1iHsA3BsR2YKPLH5ocXGEAbutXJNEhPeErgAeN4CF1I5wRxZ79ALGn0-1DAIIUqpuRzuM3o64faPhEn67U-HOVW4A5Om8YFsMun5nUDNOjZ_rxxnEqOtxa/s320/2.png" width="320" /></a></div>
<div>
<b><br /></b></div>
<div>
<b><br /></b></div>
<div>
Now we have configured the OpenJMS JNDI server, Next we need to create links to the JNDI names available on the Open JMS. In our case we have 2 JNDI names available in OpenJMS.</div>
<div>
<ol style="text-align: left;">
<li>For Queue connection Factory : "<b>JmsQueueConnectionFactory</b>"</li>
<li>For the queue "<b>queue1</b>"</li>
</ol>
<div>
<b>Creating Links to the JNDI Names</b></div>
</div>
<div>
<ol style="text-align: left;">
<li>Again goto the newly created connection factory and Click the <b>Links </b>tab</li>
<li>Click <b>New</b> and enter the below details</li>
<ul>
<li><span style="background-color: white; font-family: Tahoma, Verdana, Helvetica, sans-serif; font-size: 11px; font-weight: bold;">Name: Link1</span></li>
<li><span style="background-color: white; font-family: Tahoma, Verdana, Helvetica, sans-serif; font-size: 11px; font-weight: bold;">Local JNDI Name: </span><span style="font-family: Tahoma, Verdana, Helvetica, sans-serif;"><span style="font-size: 11px;"><b>JmsQueueConnectionFactory</b></span></span></li>
<li><span style="font-family: Tahoma, Verdana, Helvetica, sans-serif;"><span style="font-size: 11px;"><b><span style="background-color: white;">Remote JNDI Name: </span>JmsQueueConnectionFactory</b></span></span></li>
</ul>
<div>
<ol></ol>
</div>
<li>Click <b>OK</b></li>
<li>Again Click on <b>New</b> and Enter below details</li>
</ol>
<ul style="text-align: left;"><ul>
<li><span style="background-color: white; font-family: Tahoma, Verdana, Helvetica, sans-serif; font-size: 11px; font-weight: bold;">Name: Link2</span></li>
<li><span style="background-color: white; font-family: Tahoma, Verdana, Helvetica, sans-serif; font-size: 11px; font-weight: bold;">Local JNDI Name: queue1</span></li>
<li><span style="font-family: Tahoma, Verdana, Helvetica, sans-serif;"><span style="font-size: 11px;"><b><span style="background-color: white;">Remote JNDI Name: queue1</span></b></span></span></li>
</ul>
</ul>
<div>
<span style="font-family: Tahoma, Verdana, Helvetica, sans-serif; font-size: x-small;"><b>The output should look like below</b></span></div>
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmWaldzhE_mH7bmdM6dGxCHsyyPoci2CkGLn7PERTH-SybwxReKraen0KT18l-SbWh5EnUJXK223cUsRK0obhwM5kude7_aSAqJCL0bDA9fQDcQsZnRxNW_oNA9vwqFlTqYQQF9phyphenhyphenfhRf/s1600/3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="97" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmWaldzhE_mH7bmdM6dGxCHsyyPoci2CkGLn7PERTH-SybwxReKraen0KT18l-SbWh5EnUJXK223cUsRK0obhwM5kude7_aSAqJCL0bDA9fQDcQsZnRxNW_oNA9vwqFlTqYQQF9phyphenhyphenfhRf/s400/3.png" width="400" /></a></div>
<div>
<span style="font-family: Tahoma, Verdana, Helvetica, sans-serif;">That's it the weblogic server configuration is over. Now we can work on our OSB business service.</span></div>
<div>
<span style="font-family: Tahoma, Verdana, Helvetica, sans-serif;"><span style="font-size: 11px;"><b><br /></b></span></span></div>
<div style="text-align: left;">
<b><span style="font-family: inherit; font-size: large;">Configuring Business Service:-</span></b></div>
<div style="text-align: left;">
</div>
<ol style="text-align: left;">
<li><span style="font-family: inherit;">Create the OBS Configuration and Project and create a business Service.</span></li>
<li><span style="font-family: inherit;">In the <b>General configuration </b>select "<b>Messaging Service</b>"</span></li>
<li><span style="font-family: inherit;">Int the <b>Messaging </b>tab select <b>Text</b> for "Request Message Type"</span></li>
<li><span style="font-family: inherit;">Goto the <b>Transport </b>tab </span></li>
<ol>
<li>Select <b>JMS </b>as protocol.</li>
<li>Enter the Endpoint URI as <b>"jms://localhost:7001/JmsQueueConnectionFactory/queue1" </b>click A<b>dd</b>.</li>
</ol>
<li><span style="font-family: inherit;">Goto "<b>JMS Transport</b>" tab </span></li>
<ol>
<li>Check <b>Queue</b> for destination type</li>
<li>Check <b>Text</b> for Message type</li>
</ol>
<li><span style="font-family: inherit;">Save the business service and Test it by </span><b style="font-family: inherit;">Run As-> Run On Server </b><span style="font-family: inherit;">from the "Project </span>explorer"<span style="font-family: inherit;"> view.</span></li>
<li>When you get the testing browser enter some text in the payload text box and click <b>Execute</b>.</li>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-fGNEfZmbckQTsZKpvrYDJTxBRtaYwod1XaMPIcR2vNIl6MiXpCiksxYtIfNHdNWT3Ea78XpU-aWuJEWp-OTCaSsIKVpEPZW1yuN6t9YAl68CWsrJPcwFe2apgDP69cmQ0LjrDyh0UQAF/s1600/4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-fGNEfZmbckQTsZKpvrYDJTxBRtaYwod1XaMPIcR2vNIl6MiXpCiksxYtIfNHdNWT3Ea78XpU-aWuJEWp-OTCaSsIKVpEPZW1yuN6t9YAl68CWsrJPcwFe2apgDP69cmQ0LjrDyh0UQAF/s320/4.png" width="320" /></a></div>
<li>Now the message is sent to the JMS provider. Lets create a small JMS consumer example to consume the message sent</li>
</ol>
<br />
<div style="text-align: left;">
<span style="font-family: inherit; font-size: large;">Consumer Program:- </span></div>
<div style="text-align: left;">
<span style="font-family: inherit; font-size: large;"><br /></span></div>
<div style="text-align: left;">
</div>
package com.mak.jms;<br />
<br />
import java.util.Hashtable;<br />
<br />
import javax.jms.JMSException;<br />
import javax.jms.Message;<br />
import javax.jms.Queue;<br />
import javax.jms.QueueConnection;<br />
import javax.jms.QueueConnectionFactory;<br />
import javax.jms.QueueReceiver;<br />
import javax.jms.QueueSession;<br />
import javax.jms.Session;<br />
import javax.jms.TextMessage;<br />
import javax.naming.Context;<br />
import javax.naming.InitialContext;<br />
import javax.naming.NamingException;<br />
<br />
public class JMSReceiver {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>public static void main(String[] args)<br />
{<br />
try<br />
{<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>Hashtable properties = new Hashtable();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>properties.put(Context.INITIAL_CONTEXT_FACTORY,<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>"org.exolab.jms.jndi.InitialContextFactory");<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>properties.put(Context.PROVIDER_URL, "rmi://localhost:1099/");<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>Context context = new InitialContext(properties);<br />
<br />
// retrieve queue connection factory<br />
QueueConnectionFactory<br />
queueConnectionFactory =<br />
(QueueConnectionFactory)context.lookup(<br />
"JmsQueueConnectionFactory");<br />
<br />
// create a queue connection<br />
QueueConnection queueConnection =<br />
queueConnectionFactory.createQueueConnection();<br />
<br />
// start delivery of incoming messages<br />
queueConnection.start();<br />
<br />
// create a queue session<br />
// set transactions to false and set auto<br />
// acknowledgement of receipt of messages<br />
QueueSession queueSession =<br />
queueConnection.createQueueSession(<br />
false,Session.AUTO_ACKNOWLEDGE);<br />
<br />
// retrieve queue<br />
Queue queue =<br />
(Queue)context.lookup("queue1");<br />
<br />
// create a queue receiver and associate<br />
// to the retrieved queue<br />
QueueReceiver queueReceiver =<br />
queueSession.createReceiver(queue);<br />
<br />
// receive message using the synchronous<br />
// receive method<br />
Message message = queueReceiver.receive();<br />
String messageText = null;<br />
if (message instanceof TextMessage)<br />
messageText =<br />
((TextMessage)message).getText();<br />
System.out.println(messageText);<br />
<br />
}<br />
catch (NamingException e)<br />
{<br />
e.printStackTrace();<br />
}<br />
catch (JMSException e)<br />
{<br />
e.printStackTrace();<br />
}<br />
}<br />
}<br />
<div style="font-family: inherit; font-size: x-large;">
<br /></div>
<div style="font-family: inherit;">
Add the following below into classpath and run the above code snippet which should display the text sent from the OSB BS.</div>
<div style="font-family: inherit;">
<pre class="jive-pre" style="background-color: #eeeeee; background-image: url(https://forums.oracle.com/forums/images/quote-background-1.gif); border-color: rgb(238, 238, 238) rgb(238, 238, 238) rgb(238, 238, 238) rgb(204, 204, 204); border-style: solid; border-width: 1px 1px 1px 2px; font-family: 'courier new', monospaced; font-size: 10pt; margin: 1em 2em 0.5em; overflow: auto; padding: 10px 10px 10px 1em;"><code class="jive-code jive-java"><span style="font-family: 'courier new', monospaced; font-size: 10pt;"><OpenJMS_Home>/lib/</span>castor-0.9.5.jar
<span style="font-family: 'courier new', monospaced; font-size: 10pt;"><OpenJMS_Home>/lib/</span>concurrent-1.3.4.jar
<span style="font-family: 'courier new', monospaced; font-size: 10pt;"><OpenJMS_Home>/lib/</span>openjms-0.7.7-beta-1.jar
<span style="font-family: 'courier new', monospaced; font-size: 10pt;"><OpenJMS_Home>/lib/</span>openjms-common-0.7.7-beta-1.jar
<span style="font-family: 'courier new', monospaced; font-size: 10pt;"><OpenJMS_Home>/lib/</span>openjms-net-0.7.7-beta-1.jar
<span style="font-family: 'courier new', monospaced; font-size: 10pt;"><OpenJMS_Home>/lib/</span>openjms-tools-0.7.7-beta-1.jar
<span style="font-family: 'courier new', monospaced; font-size: 10pt;"><OpenJMS_Home>/lib/</span>spice-jndikit-1.2.jar</code></pre>
</div>
<br />
<div>
<span style="font-family: Tahoma, Verdana, Helvetica, sans-serif;"><span style="font-size: 11px;"><b><br /></b></span></span></div>
<div>
<span style="font-family: Tahoma, Verdana, Helvetica, sans-serif;"><span style="font-size: 11px;"><b><br /></b></span></span></div>
<div>
<span style="font-family: Tahoma, Verdana, Helvetica, sans-serif;"><b>That's it. Happy coding. :)</b></span></div>
</div>
Arunhttp://www.blogger.com/profile/07140801903121620510noreply@blogger.com0tag:blogger.com,1999:blog-6044389965670817464.post-83849983458752308222011-02-20T07:24:00.002-08:002022-12-27T03:35:23.224-08:00Android Tamil Keyboard<div dir="ltr" style="text-align: left;" trbidi="on"><span class="Apple-style-span" style="font-family: arial; font-size: 14px; line-height: 25px;">வணக்கம் </span><br />
<div><div style="text-align: left;">இன்று தமிழை Android கைபேசியில் உள்ளீடு செய்ய உதவும் மென்பொருளை வெளியிட்டுள்ளேன். இதை பயன்படுத்த Android marketல் Tamil Keyboard என தேடி நிறுவவும். </div></div><div class="separator" style="clear: both; text-align: center;"><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmRKOYFMRkUwI2XkJ158TjfgxC7nSslDPlSqyoNKQoo9e598Nt3urOpELjGhbpBE6fGp3fUfom-fch3267QZHl1yeCUvheW-6uJun5UoTvzAm9k8ZUVlWvx7zylogF30ZbUSpkBvn5LnqK63Q0fRk2EFJva7VD8YflNOr9_EvOqN0bBkAsJWue5FuL4w/s1920/Screenshot_1630299603.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1920" data-original-width="1080" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmRKOYFMRkUwI2XkJ158TjfgxC7nSslDPlSqyoNKQoo9e598Nt3urOpELjGhbpBE6fGp3fUfom-fch3267QZHl1yeCUvheW-6uJun5UoTvzAm9k8ZUVlWvx7zylogF30ZbUSpkBvn5LnqK63Q0fRk2EFJva7VD8YflNOr9_EvOqN0bBkAsJWue5FuL4w/s320/Screenshot_1630299603.png" width="180" /></a></div><br /><br /></div><br />
<span class="Apple-style-span" style="font-family: arial; font-size: 14px; line-height: 25px;">நிறுவிய பிறகு:-</span><br />
<span class="Apple-style-span" style="font-family: arial; font-size: 14px; line-height: 25px;">Goto Settings -> Language & Keyboard -> Tamil Keyboard Enable </span><span class="Apple-style-span" style="font-family: arial; font-size: 14px; line-height: 25px;">செய்யவும்.</span><br />
<span class="Apple-style-span" style="font-family: arial; font-size: 14px; line-height: 25px;"><br />
</span><br />
<div style="text-align: left;"><div style="text-align: left;"><div style="text-align: left;"><span class="Apple-style-span" style="font-family: arial; font-size: 14px; line-height: 25px;">இதில் 2 keyboards உள்ளன. ஒன்றிலிருந்து மற்றொன்றிற்கு மாற கீழிருந்து மேல் swipe செய்யவும். இடைவெளி விட வலமிருந்து இடம் </span><span class="Apple-style-span" style="font-family: arial; font-size: 14px; line-height: 25px;">ஒரு சிறிய swipe செய்யவும். </span></div></div></div><span class="Apple-style-span" style="font-family: arial; font-size: 14px; line-height: 25px;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: arial;"><span class="Apple-style-span" style="font-size: 14px; line-height: 25px;">மிக்க நன்றி. </span></span></div>Arunhttp://www.blogger.com/profile/07140801903121620510noreply@blogger.com52