<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by janaka pushpakumara on Medium]]></title>
        <description><![CDATA[Stories by janaka pushpakumara on Medium]]></description>
        <link>https://medium.com/@bajpushpakumara?source=rss-404b675a100e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*onob8VJIRmi_W98ZzeCuiQ.png</url>
            <title>Stories by janaka pushpakumara on Medium</title>
            <link>https://medium.com/@bajpushpakumara?source=rss-404b675a100e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 17:24:50 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@bajpushpakumara/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Diagnosing and Fixing WSO2 Startup Hang-Ups]]></title>
            <link>https://bajpushpakumara.medium.com/wso2-server-stuck-during-startup-25ed4b39aa2b?source=rss-404b675a100e------2</link>
            <guid isPermaLink="false">https://medium.com/p/25ed4b39aa2b</guid>
            <category><![CDATA[mysql]]></category>
            <category><![CDATA[integration]]></category>
            <category><![CDATA[wso2]]></category>
            <category><![CDATA[debugging]]></category>
            <dc:creator><![CDATA[janaka pushpakumara]]></dc:creator>
            <pubDate>Thu, 12 Dec 2024 14:24:42 GMT</pubDate>
            <atom:updated>2024-12-12T14:28:04.993Z</atom:updated>
            <content:encoded><![CDATA[<h4>Recently, during a customer engagement, we encountered a P1 incident where the WSO2 server failed to complete its startup process. This blog post outlines our step-by-step debugging approach that we used, the tools used, and how we ultimately resolved the issue.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wtS0jZP6FTTQVhWrA1p4pw.jpeg" /></figure><h3>Initial Observations</h3><p>The server logs revealed that the startup process was incomplete. The “carbon.log” file contained only a few lines of startup logs, indicating that the startup process had stalled mid-way. To investigate further, we collected a thread dump from the server.</p><pre>jstack &lt;WSO2_server_PID&gt; &gt; Threadump.txt</pre><h3>Thread Dump Analysis</h3><p>The thread dump revealed that one of the threads was stuck in the RUNNABLE state for a significant period of time without changing its state. Below is an excerpt from the stack trace of the blocked thread.</p><pre>&quot;Framework Event Dispatcher: Equinox Container: 933e7c47-5c2a-433e-94f6-abc8a9db0ff1&quot; #21 daemon prio=5 os_prio=0 tid=0x00007f17f8bd5000 nid=0x3753f7 runnable [0x00007f17e1626000]<br>   java.lang.Thread.State: RUNNABLE<br> at java.net.SocketInputStream.socketRead0(Native Method)<br> at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)<br> at java.net.SocketInputStream.read(SocketInputStream.java:171)<br> at java.net.SocketInputStream.read(SocketInputStream.java:141)<br> at com.mysql.cj.protocol.ReadAheadInputStream.fill(ReadAheadInputStream.java:107)<br> at com.mysql.cj.protocol.ReadAheadInputStream.readFromUnderlyingStreamIfNecessary(ReadAheadInputStream.java:150)<br> at com.mysql.cj.protocol.ReadAheadInputStream.read(ReadAheadInputStream.java:180)<br> - locked &lt;0x00000006c2921808&gt; (a com.mysql.cj.protocol.ReadAheadInputStream)<br> at java.io.FilterInputStream.read(FilterInputStream.java:133)<br> at com.mysql.cj.protocol.FullReadInputStream.readFully(FullReadInputStream.java:64)<br> at com.mysql.cj.protocol.a.SimplePacketReader.readHeaderLocal(SimplePacketReader.java:81)<br> at com.mysql.cj.protocol.a.SimplePacketReader.readHeader(SimplePacketReader.java:63)<br>..........<br> at com.mysql.cj.protocol.a.NativeProtocol.sendCommand(NativeProtocol.java:700)<br> at com.mysql.cj.protocol.a.NativeProtocol.sendQueryPacket(NativeProtocol.java:1051)<br> at com.mysql.cj.protocol.a.NativeProtocol.sendQueryString(NativeProtocol.java:997)<br> at com.mysql.cj.NativeSession.execSQL(NativeSession.java:663)<br> at com.mysql.cj.jdbc.ConnectionImpl.commit(ConnectionImpl.java:790)<br> - locked &lt;0x00000006c27e7128&gt; (a com.mysql.cj.jdbc.ConnectionImpl)<br> at sun.reflect.GeneratedMethodAccessor53.invoke(Unknown Source)<br> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)<br> at java.lang.reflect.Method.invoke(Method.java:498)<br> at org.apache.tomcat.jdbc.pool.ProxyConnection.invoke(ProxyConnection.java:126)<br> at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:108)<br> at org.apache.tomcat.jdbc.pool.interceptor.AbstractCreateStatementInterceptor.invoke(AbstractCreateStatementInterceptor.java:79)<br> at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:108)<br> at org.apache.tomcat.jdbc.pool.interceptor.AbstractCreateStatementInterceptor.invoke(AbstractCreateStatementInterceptor.java:79)<br> at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:108)<br> at org.apache.tomcat.jdbc.pool.interceptor.ConnectionState.invoke(ConnectionState.java:152)<br> at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:108)<br> at org.apache.tomcat.jdbc.pool.TrapException.invoke(TrapException.java:40)<br> at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:108)<br> at org.apache.tomcat.jdbc.pool.interceptor.AbstractCreateStatementInterceptor.invoke(AbstractCreateStatementInterceptor.java:79)<br> at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:108)<br> at org.apache.tomcat.jdbc.pool.DisposableConnectionFacade.invoke(DisposableConnectionFacade.java:81)<br> at com.sun.proxy.$Proxy49.commit(Unknown Source)<br> at org.wso2.carbon.registry.core.jdbc.dataaccess.ConnectionWrapper.commit(ConnectionWrapper.java:96)<br> at org.wso2.carbon.registry.core.jdbc.dataaccess.JDBCDatabaseTransaction$ManagedRegistryConnection.commit(JDBCDatabaseTransaction.java:1222)<br> at org.wso2.carbon.registry.core.jdbc.dataaccess.JDBCTransactionManager.commitTransaction(JDBCTransactionManager.java:170)<br> at org.wso2.carbon.registry.core.jdbc.EmbeddedRegistry.commitTransaction(EmbeddedRegistry.java:452)<br> at org.wso2.carbon.registry.core.jdbc.EmbeddedRegistry.put(EmbeddedRegistry.java:741)<br> at org.wso2.carbon.registry.core.caching.CacheBackedRegistry.put(CacheBackedRegistry.java:591)<br> at org.wso2.carbon.registry.core.session.UserRegistry.putInternal(UserRegistry.java:840)<br> at org.wso2.carbon.registry.core.session.UserRegistry.access$1000(UserRegistry.java:73)<br> at org.wso2.carbon.registry.core.session.UserRegistry$11.run(UserRegistry.java:816)<br> at org.wso2.carbon.registry.core.session.UserRegistry$11.run(UserRegistry.java:813)<br> at java.security.AccessController.doPrivileged(Native Method)<br> at org.wso2.carbon.registry.core.session.UserRegistry.put(UserRegistry.java:813)<br> at org.wso2.carbon.core.init.CarbonServerManager.populateConnectionProperties(CarbonServerManager.java:678)<br> at org.wso2.carbon.core.init.CarbonServerManager.initializeCarbon(CarbonServerManager.java:450)<br> at org.wso2.carbon.core.init.CarbonServerManager.removePendingItem(CarbonServerManager.java:305)<br> - locked &lt;0x00000006c3d2c610&gt; (a java.lang.Object)<br> at org.wso2.carbon.core.init.PreAxis2ConfigItemListener.bundleChanged(PreAxis2ConfigItemListener.java:118)<br> - locked &lt;0x00000006c3d278b0&gt; (a org.wso2.carbon.core.init.PreAxis2ConfigItemListener)<br> at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:973)<br> at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234)<br> at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:345)</pre><p>The stack trace pointed to a thread being stuck in a socketRead while committing a transaction to the database. That means the DB is not responding back to the commit transaction.</p><pre>at com.mysql.cj.jdbc.ConnectionImpl.commit(ConnectionImpl.java:790)</pre><h3>Investigating the Database</h3><p>To better understand why the transaction was stuck, we queried the database’s process list using.</p><pre>SHOW FULL PROCESSLIST;</pre><p>The output revealed multiple queries in the &quot;waiting for handler commit&quot; state, with execution times exceeding acceptable limits:</p><pre>| Id  | User         | Host           | db         | Command | Time   | State                      | Info   |<br>|-----|--------------|----------------|------------|---------|--------|----------------------------|--------|<br>| 828 | sharedadmin  | localhost:41938 | shared_db  | Query   | 68515  | waiting for handler commit | commit |<br>| 869 | sharedadmin  | localhost:49586 | shared_db  | Query   | 68515  | waiting for handler commit | commit |<br>...</pre><p>To gather more insights, we executed the following command to check the status of InnoDB transactions:</p><pre>SHOW ENGINE INNODB STATUS\G;</pre><p>The output confirmed that several transactions were in an ACTIVE (PREPARED) state for an extended period, indicating potential issues with transaction handling. However, the exact cause of the delay was still unclear.</p><pre>output <br><br>Trx id counter 87415<br>Purge done for trx&#39;s n:o &lt; 87398 undo n:o &lt; 0 state: running but idle<br>History list length 0<br>LIST OF TRANSACTIONS FOR EACH SESSION:<br>---TRANSACTION 421814958550984, not started<br>0 lock struct(s), heap size 1128, 0 row lock(s)<br>......<br>......<br>---TRANSACTION 87391, ACTIVE (PREPARED) 75967 sec<br>8 lock struct(s), heap size 1128, 11 row lock(s), undo log entries 7<br>MySQL thread id 828, OS thread handle 140338532034304, query id 3230205 localhost 127.0.0.1 sharedadmin waiting for handler commit<br>commit<br>---TRANSACTION 87390, ACTIVE (PREPARED) 75967 sec<br>8 lock struct(s), heap size 1128, 20 row lock(s), undo log entries 13<br>MySQL thread id 869, OS thread handle 140338567964416, query id 3230197 localhost 127.0.0.1 sharedadmin waiting for handler commit<br>commit</pre><h3>Analyzing MySQL Logs</h3><p>Since the database queries and InnoDB status did not provide definitive answers, we turned to the MySQL server logs. The logs showed repeating error messages:</p><pre>[ERROR] [MY-000035] [Server] Disk is full writing &#39;./binlog.000018&#39; <br>  (OS errno 28 - No space left on device). Waiting for someone to free space... <br>  Retry in 60 secs. Message reprinted in 600 secs.</pre><p>This pointed to a critical issue, the disk hosting MySQL’s binary logs had run out of space.</p><h3>Verifying Disk Space</h3><p>To confirm, we checked the server’s disk usage using the df -h command:</p><pre>Filesystem      Size  Used Avail Use% Mounted on<br>/dev/xxx/xxx    8.0G  8.0G   20K 100% /var</pre><p>The /var partition, where MySQL stores its binary logs, was completely full. This prevented MySQL from writing to its binary logs, causing the transactions to be stuck in the &quot;waiting for handler commit&quot; state.</p><h3>Resolution</h3><p>The root cause was insufficient disk space. To resolve the issue. We cleared old and unnecessary files from the /var partition to free up space. Restarted the MySQL server to recover from the stalled transactions. Adjusted MySQL’s binary log settings to manage disk usage more effectively in the future.</p><h3>Lessons Learned</h3><p>This incident highlights the importance of,</p><ol><li><strong>Monitoring Disk Usage:</strong> Ensure adequate monitoring tools are in place to alert when disk usage approaches critical levels.</li><li><strong>Configuring Log Rotation:</strong> Configure MySQL’s binary log rotation to prevent disk space exhaustion.</li><li><strong>Holistic Debugging:</strong> System issues often involve multiple components. Debugging requires examining application logs, thread dumps, database statuses, and server logs in tandem.</li></ol><p>By following a systematic approach, we were able to identify and resolve the issue efficiently. I hope this post helps others facing similar challenges.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=25ed4b39aa2b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Guide of XML Processing Instructions inWSO2 EI/MI]]></title>
            <link>https://bajpushpakumara.medium.com/a-guide-of-xml-processing-instructions-inwso2-ei-mi-dec4ab17f6a2?source=rss-404b675a100e------2</link>
            <guid isPermaLink="false">https://medium.com/p/dec4ab17f6a2</guid>
            <category><![CDATA[wso2-mi]]></category>
            <category><![CDATA[json]]></category>
            <category><![CDATA[xml-to-json-converter]]></category>
            <category><![CDATA[xml]]></category>
            <category><![CDATA[wso2-ei]]></category>
            <dc:creator><![CDATA[janaka pushpakumara]]></dc:creator>
            <pubDate>Thu, 07 Mar 2024 10:06:01 GMT</pubDate>
            <atom:updated>2024-03-07T10:06:01.799Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MotsF-0AY9pNxKW0KF_x_A.jpeg" /></figure><p>XML Processing Instructions play a pivotal role in when manipulating XML messages and transforming XML to json / json to XML within the WSO2 Enterprise Integrator (EI) and Micro Integrator (MI). In this blog post, we’ll dive into powerful XML processing instructions that significantly impact how XML/JSON data is represented and processed within the WSO2 EI/MI environment.</p><h3>&lt;?xml-multiple <strong>[nameofthexmlnode]</strong>?&gt;</h3><p>This processing instruction is a hidden gem that enables seamless integration of XML to JSON transformation.</p><p>With the inclusion of the &lt;?xml-multiple <strong>item</strong>?&gt; processing instruction, the output structure changes to represent an array of “<strong>item</strong>” objects. This is particularly useful when you want to handle scenarios where multiple occurrences of the same element might occur, ensuring a consistent JSON representation.</p><h4>Example 1:</h4><p>Input:</p><pre>&lt;items xmlns=&quot;&quot;&gt;<br>    &lt;item&gt;<br>        &lt;REQUEST_STATUS&gt;SUCCESSFUL1&lt;/REQUEST_STATUS&gt;<br>        &lt;REQUEST_STATUS&gt;SUCCESSFUL2&lt;/REQUEST_STATUS&gt;<br>    &lt;/item&gt;<br>&lt;/items&gt;</pre><p>Output:</p><p>By recognizing the repeated occurrence of &lt;REQUEST_STATUS&gt; within the &lt;item&gt; element, WSO2 EI intelligently serializes them into a JSON array</p><pre>{<br>    &quot;items&quot;: {<br>        &quot;item&quot;: {<br>            &quot;REQUEST_STATUS&quot;: [<br>                &quot;SUCCESSFUL1&quot;,<br>                &quot;SUCCESSFUL2&quot;<br>            ]<br>        }<br>    }<br>}</pre><h4>Example 2:</h4><p>Input:</p><pre>&lt;items xmlns=&quot;&quot;&gt;<br>    &lt;item&gt;<br>        &lt;REQUEST_STATUS&gt;SUCCESSFUL&lt;/REQUEST_STATUS&gt;<br>    &lt;/item&gt;<br>&lt;/items&gt;</pre><p>Output:</p><p>If the &lt;item&gt; element contains only a single &lt;REQUEST_STATUS&gt; child element. Despite having a single child element, WSO2 EI interprets “item” as an object (not an array) in the JSON output. The resulting JSON structure represents “item” as an object with a single “REQUEST_STATUS” value</p><pre>{<br>    &quot;items&quot;: {<br>        &quot;item&quot;: {<br>            &quot;REQUEST_STATUS&quot;: &quot;SUCCESSFUL&quot;<br>        }<br>    }<br>}</pre><p>Input:</p><p>The inclusion of the &lt;?xml-multiple item?&gt; processing instruction marks the &lt;item&gt; element as a container for multiple occurrences, even when only one occurrence is present. As a result, WSO2 EI interprets “item” as an <strong>array</strong>, ensuring consistency in the JSON output structure. In this case, the JSON output depicts “item” as an array containing a single object with the “REQUEST_STATUS” value.</p><pre>&lt;items xmlns=&quot;&quot;&gt;<br>    &lt;item&gt;<br>        &lt;?xml-multiple item?&gt;<br>        &lt;REQUEST_STATUS&gt;SUCCESSFUL&lt;/REQUEST_STATUS&gt;<br>    &lt;/item&gt;<br>&lt;/items&gt;</pre><p>Output:</p><pre>{<br>    &quot;items&quot;: {<br>        &quot;item&quot;: [<br>            {<br>                &quot;REQUEST_STATUS&quot;: &quot;SUCCESSFUL&quot;<br>            }<br>        ]<br>    }<br>}</pre><h4>Example 3:</h4><p>Input:</p><pre>&lt;jsonObject xmlns=&quot;http://ws.apache.org/ns/synapse&quot;&gt;<br>    &lt;?xml-multiple jsonObject?&gt;<br>    &lt;jsonObject xmlns=&quot;&quot;&gt;<br>        &lt;REQUEST_STATUS&gt;SUCCESSFUL&lt;/REQUEST_STATUS&gt;<br>    &lt;/jsonObject&gt;<br>&lt;/jsonObject&gt;</pre><p>output:</p><pre>[<br>    {<br>        &quot;REQUEST_STATUS&quot;: &quot;SUCCESSFUL&quot;<br>    }<br>]</pre><h3>xsi:nil</h3><p>When dealing with XML-to-JSON transformations, controlling the representation of null values becomes crucial. WSO2 EI provides the flexibility to adjust the xsi:nil attribute, offering fine-tuned control over how null values are handled. Let’s explore an example:</p><h4>Example 1:</h4><pre>&lt;items xmlns=&quot;&quot;&gt;<br>    &lt;item&gt;<br>        &lt;REQUEST_STATUS /&gt;<br>    &lt;/item&gt;<br>&lt;/items&gt;</pre><p>Corresponding JSON representation:</p><pre>{<br>    &quot;items&quot;: {<br>        &quot;item&quot;: {<br>            &quot;REQUEST_STATUS&quot;: null<br>        }<br>    }<br>}</pre><h4>Example 2: xsi:nil=”true”</h4><pre>&lt;items xmlns=&quot;&quot;&gt;<br>    &lt;item&gt;<br>        &lt;REQUEST_STATUS xsi:nil=&quot;true&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;/&gt;<br>    &lt;/item&gt;<br>&lt;/items&gt;</pre><p>Corresponding JSON representation:</p><pre>{<br>    &quot;items&quot;: {<br>        &quot;item&quot;: {<br>            &quot;REQUEST_STATUS&quot;: {<br>                &quot;@nil&quot;: &quot;true&quot;<br>            }<br>        }<br>    }<br>}</pre><p>In this exploration, we unravel the significance of these XML processing instructions, showcasing their impact on JSON/XML handling within the WSO2 EI environment.</p><p>Stay tuned as we delve deeper into each example, providing insights and best practices for effective integration.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dec4ab17f6a2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Quick Guide to OQL in Eclipse MAT]]></title>
            <link>https://bajpushpakumara.medium.com/quick-guide-to-oql-in-eclipse-mat-eeb3fb3e9267?source=rss-404b675a100e------2</link>
            <guid isPermaLink="false">https://medium.com/p/eeb3fb3e9267</guid>
            <category><![CDATA[mat]]></category>
            <category><![CDATA[wso2-mi]]></category>
            <category><![CDATA[wso2]]></category>
            <dc:creator><![CDATA[janaka pushpakumara]]></dc:creator>
            <pubDate>Thu, 30 Nov 2023 16:22:24 GMT</pubDate>
            <atom:updated>2023-12-02T18:53:24.986Z</atom:updated>
            <content:encoded><![CDATA[<h4>Brief Overview of OQL</h4><p>If you’re exploring Java memory analysis with Eclipse Memory Analyzer (MAT), you might come across a handy tool called OQL, or Object Query Language. OQL helps you sort through heap data, allowing you to understand how your application uses run-time live objects and variables/values in a given time</p><p>In simple terms, OQL is like a language that uses JavaScript expressions. It comes with built-in parts like objects and functions.</p><p>This blog post is here to be your quick guide to using OQL in Eclipse MAT. By combining these objects and functions with JavaScript, you can create and run detailed queries to understand your run-time objects better. While the help pages have many examples, we’ll go through some specific ones below to show you how OQL can help uncover details about your application’s memory use.</p><p>To kick things off, we invite you to take a quick dive into the world of OQL with a 1-minute sample provided by MAT itself. It’s a hands-on way to experience the power of OQL without the need for an extensive tutorial. In fact, you can try it out right now by following the steps below. ( <a href="http://127.0.0.1:52655/help/topic/org.eclipse.mat.ui.help/reference/oqlsyntax.html?cp=0_4_2">OQL syntax</a> )</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mhaFLkoZMD4eqPf41Dy37g.png" /><figcaption>MAT OQL 1 Minute Sample</figcaption></figure><h4>Setting the Stage</h4><p>To start analyzing the heap dump using OQL , follow these steps: Open the heap dump using the Eclipse Memory Analyzer and navigate to the OQL window.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dNb36UxUBm69aKwan05EcA.png" /><figcaption>OQL option</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aq4-EJ6wx_ZnhflBdxO65A.png" /><figcaption>OQL Console</figcaption></figure><p>OQL operates using JavaScript expressions, equipped with built-in components like objects and functions. Let’s go through the sample queries to understand how it works and get the best out of it.</p><h4>Text reference search</h4><p>Text search using OQL is crucial for swiftly pinpointing specific content within Java heap dumps, aiding developers in efficiently identifying and addressing text-related issues. By leveraging OQL’s capabilities, developers can streamline the process of locating and analyzing textual data, enhancing their ability to troubleshoot and optimize Java applications.</p><p>byte[] search</p><pre>SELECT * FROM byte[] b WHERE toString(b) LIKE &quot;.*text to search.*&quot;</pre><p>String search</p><pre>SELECT * FROM java.lang.String s WHERE toString(s) LIKE &quot;.*text to search.*&quot;</pre><p>char[] search</p><pre>SELECT * FROM char[] c WHERE toString(c) LIKE &quot;.*text to search.*&quot;</pre><p>Ex:</p><pre>SELECT * FROM byte[] b WHERE toString(b) LIKE &quot;.*DummyString.*&quot;<br>SELECT * FROM char[] c WHERE toString(c) LIKE &quot;.\/SimpleProxy\/.&quot;<br>SELECT * FROM java.lang.String s WHERE toString(s) LIKE  &quot;.\/services\/SimpleProxy\/.&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*krbUTmxK7gdGENwgNvsMzA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UItqKxuMvvwyrCavByUmOQ.png" /></figure><h4>List of Extended objects</h4><p>Utilizing OQL query, filtering out objects that are instances of an abstract class becomes essential in isolating run-time object analysis at the given time.</p><p>From here onwards I will take the heap dump from the WSO2 MI server and execute the sample queries against it for your reference.</p><p>you can extract a heap dump for any java application with:</p><pre>jmap -dump:file=heap_dump-any-name.bin &lt;process id&gt;</pre><p>As an example, <a href="https://github.com/wso2/wso2-synapse/blob/master/modules/core/src/main/java/org/apache/synapse/endpoints/HTTPEndpoint.java">HTTPEndpoint</a>, <a href="https://github.com/wso2/wso2-synapse/blob/master/modules/core/src/main/java/org/apache/synapse/endpoints/AddressEndpoint.java">AddressEndpoint</a>, and other built-in endpoints are extended from the <a href="https://github.com/wso2/wso2-synapse/blob/master/modules/core/src/main/java/org/apache/synapse/endpoints/AbstractEndpoint.java">AbstractEndpoint</a> public abstract class.</p><p>let&#39;s extract <strong>all the endpoint</strong> objects from the wso2 MI server heap dump by querying the org.apache.synapse.endpoints.AbstractEndpoint class objects</p><pre>SELECT * FROM INSTANCEOF org.apache.synapse.endpoints.AbstractEndpoint s</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4F1PKyu3tIUDA-nEXDB_sA.png" /></figure><p><strong>For HTTP EP, Address EP, Failover EP</strong></p><pre>SELECT * FROM INSTANCEOF org.apache.synapse.endpoints.HTTPEndpoint s<br>SELECT * FROM INSTANCEOF org.apache.synapse.endpoints.AddressEndpoint s<br>SELECT * FROM INSTANCEOF org.apache.synapse.endpoints.FailoverEndpoint s</pre><p>Ex: You can extract the endpoint URLs without referring to any configurations using the above results.</p><pre>SELECT s.definition.address.toString() FROM INSTANCEOF org.apache.synapse.endpoints.AbstractEndpoint s </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7i2CXP2yF2J_tKgo_4ijAQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E1VbT3fFuzFtsoHn-9UGhA.png" /></figure><h4>List the custom class mediators deployed in wso2 MI</h4><p>If you need to check whether there are any class mediators deployed use the below query.</p><pre>SELECT s FROM INSTANCEOF &quot;org.apache.synapse.mediators.AbstractMediator&quot; s<br>WHERE ((toString(s.@displayName.contains(&quot;org.apache.synapse.mediators&quot;)) = &quot;false&quot;)<br>and (toString(s.@displayName.contains(&quot;org.wso2.carbon&quot;)) = &quot;false&quot;)<br>and (toString(s.@displayName.contains(&quot;org.apache.synapse.config.xml.AnonymousListMediator&quot;)) = &quot;false&quot;))</pre><h4>List the custom synapse handlers</h4><p>If you need to check whether there are any synapse handlers deployed use the below query</p><pre>SELECT * FROM INSTANCEOF &quot;org.apache.synapse.SynapseHandler&quot; s</pre><h4>List the custom API handlers</h4><pre>SELECT * FROM INSTANCEOF &quot;org.apache.synapse.rest.AbstractHandler&quot; s</pre><h4>Table View</h4><pre>SELECT s.@displayName AS &quot;class name&quot;, s.@objectAddress AS &quot;object Address&quot; <br>FROM INSTANCEOF org.apache.synapse.endpoints.AbstractEndpoint s</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qKOaOwNeji6KcIHq" /></figure><p><strong>Note</strong></p><p>Properties of heap objects are accessed using a simple dot notation:( [ &lt;alias&gt;. ] &lt;field&gt; . &lt;field&gt;. &lt;field&gt;) An alias can be defined in the FROM Clause to identify the current object, i.e. row in the SQL analogy, on which the OQL statement operates. Without alias, the field is assumed to be one of the fields of the current object. Fields are attributes of the Java objects in the heap dump. Use <a href="http://127.0.0.1:52655/help/topic/org.eclipse.mat.ui.help/reference/tipsandtricks.html#oqlcompletion">OQL autocompletion</a> or the Object Inspector to find out about the <strong>available fields of an object</strong>.</p><h4>List the Rolling log file appenders</h4><pre>SELECT s.@displayName AS &quot;class name&quot;, s.name.toString() AS &quot;RollingFileAppender name&quot; <br>FROM INSTANCEOF org.apache.logging.log4j.core.appender.RollingFileAppender s</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5ehRPeOrnKrc6SReYNyXBw.png" /></figure><h4>List the Thread Objects</h4><pre>SELECT * from java.lang.Thread t WHERE toString(t.name) <br>LIKE &quot;PassThroughMessageProcessor-.*&quot;<br><br>SELECT * from java.lang.Thread t WHERE toString(t.name) <br>LIKE &quot;SynapseWorker-.*&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J4nn7u7fluZtJcC5ZBzGcQ.png" /></figure><h4>Key Takeaways</h4><ul><li>OQL, or Object Query Language, is a powerful tool for filtering and querying Java heap data, operating with JavaScript expressions and incorporating built-in objects and functions.</li><li>The provided sample queries demonstrate OQL’s versatility, enabling users to conduct various complex searches.</li></ul><h4>Encouragement:</h4><p>Explore the full potential of OQL in your memory analysis tasks. Dive deeper into its features and apply custom queries to gain valuable insights into your application’s memory usage, troubleshoot issues, and optimize performance. OQL is a valuable asset for developers seeking a nuanced understanding of their Java applications.</p><p>Thank you for taking the time to explore this blog post. I hope you found valuable insights into leveraging OQL for memory analysis. Stay tuned for My next blog post, where we’ll delve into even more exciting topics. Until then, happy coding and happy exploring!.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eeb3fb3e9267" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Java Flight Recorder (JFR)]]></title>
            <link>https://bajpushpakumara.medium.com/java-flight-recorder-jfr-c601afdb96a7?source=rss-404b675a100e------2</link>
            <guid isPermaLink="false">https://medium.com/p/c601afdb96a7</guid>
            <category><![CDATA[preformance]]></category>
            <category><![CDATA[jfr]]></category>
            <category><![CDATA[jmc]]></category>
            <category><![CDATA[profiling]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[janaka pushpakumara]]></dc:creator>
            <pubDate>Wed, 16 Nov 2022 17:38:38 GMT</pubDate>
            <atom:updated>2022-11-16T17:38:38.023Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/316/0*fqCXngm-26BNp2QW.png" /></figure><h3>JFR dump</h3><p>Java Flight Recorder (JFR) is a tool for collecting diagnostic and profiling data about a running Java application. It is integrated into the Java Virtual Machine (JVM) and causes almost no performance overhead, so it can be used even in heavily loaded production environments. When default settings are used, both internal testing and customer feedback indicate that performance impact is less than one percent. For some applications, it can be significantly lower. However, for short-running applications (which are not the kind of applications running in production environments), relative startup and warmup times can be larger, which might impact the performance by more than one percent.</p><p>JFR collects data about the JVM as well as the Java application running on it.</p><h3>How to get it?</h3><ul><li>Get the JVM process id</li><li>Enable the JFR feature (Java Flight Recorder requires a commercial license for use in production).</li><li>Before Java 11, both Java Flight Recorder (JFR) and Java Mission Control (JMC) are commercial products and only available in Oracle JDK, and we can enable the JFR features via the following command.</li><li>jcmd &lt;process_id&gt; VM.unlock_commercial_features</li><li>Now, the JFR is open source in OpenJDK 11, and available in the OpenJDK11/bin folder; while the JMC is not part of the JDK anymore, we can download it <a href="https://jdk.java.net/jmc/">here</a>.</li><li>To Obtain the JFR dump,</li><li>jcmd &lt;process_id&gt; JFR.start name=JVM_profiling duration=30m filename=&lt;PATH&gt;/JVM_profiling-`date +%d-%m-%Y-%H:%M:%S`.jfr</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Q5pH7ekO_0yVWDdw" /><figcaption>https://github.com/JanakaPushpakumara/troubleshoot-kit/tree/master/JFR-capture</figcaption></figure><h3>Available Parameters</h3><ul><li>duration</li><li>filename</li><li>maxsize</li></ul><h3>Diagnostic Commands</h3><p>JFR.start</p><p>Start a recording.</p><p>JFR.check</p><p>Check the status of all recordings running for the specified process, including the recording identification number, file name, duration, and so on.</p><p>JFR.stop</p><p>Stop a recording with a specific identification number (by default, recording 1 is stopped).</p><p>JFR.dump</p><p>Dump the data collected so far by the recording with a specific identification number (by default, data from recording 1 is dumped).</p><p><em>Originally published at </em><a href="https://github.com/JanakaPushpakumara/troubleshoot-kit/tree/master/JFR-capture">https://github.com/JanakaPushpakumara/troubleshoot-kit/tree/master/JFR-capture</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c601afdb96a7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to run shell scripts using Wso2 EI/MI]]></title>
            <link>https://bajpushpakumara.medium.com/how-to-run-shell-scripts-with-arguments-using-wso2-ei-mi-c117ae108733?source=rss-404b675a100e------2</link>
            <guid isPermaLink="false">https://medium.com/p/c117ae108733</guid>
            <category><![CDATA[script]]></category>
            <category><![CDATA[wso2]]></category>
            <category><![CDATA[ei]]></category>
            <category><![CDATA[bash]]></category>
            <category><![CDATA[shell]]></category>
            <dc:creator><![CDATA[janaka pushpakumara]]></dc:creator>
            <pubDate>Wed, 22 Sep 2021 15:46:45 GMT</pubDate>
            <atom:updated>2021-09-22T15:53:26.860Z</atom:updated>
            <content:encoded><![CDATA[<h3>Ex: Encrypt and sign Files Using GPG in WSO2 EI/MI</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/275/1*vpARvdFh42Xp8fo_ltzB2Q.png" /></figure><ol><li>Create a <strong>myshellScript.sh</strong> script file by adding the arguments to provide variables.</li></ol><p>Ex:</p><pre>#!/bin/bash<br>echo  $1 | gpg --pinentry-mode=loopback --batch --passphrase-fd 0 -o $2 --sign --encrypt -r janakap@wso2.com --default-key 1JD21BK458E5A7E2 $3;<br>exit;</pre><p>Original command, ( echo or the cat commad can be used to provide the <a href="https://stackoverflow.com/questions/19895122/how-to-use-gnupgs-passphrase-fd-argument">passphrase-fd argument</a> at the run time of the gpg command withot the user interaction )</p><pre><strong>echo somevalue |</strong> gpg --pinentry-mode=loopback --batch --passphrase-fd 0 -o /home/janaka/WSo2/Tickets/out.txt.gpg --sign --encrypt -r janakap@wso2.com --default-key 1JD21BK458E5A7E2 /home/janaka/WSo2/Input.txt&quot;;</pre><p>2. Create the Script mediator with the script execution logic</p><p>Ex:</p><pre>&lt;script language=&quot;js&quot;&gt;<br>&lt;![CDATA[<br>var Wso2PathOut = String(mc.getProperty(&#39;Wso2PathOut&#39;));<br>var Wso2PathIn = String(mc.getProperty(&#39;Wso2PathIn&#39;));  <br>var passphrase = String(mc.getProperty(&#39;passphrase&#39;)); <br>var command = [ &quot;sh&quot;, &quot;/home/janaka/WSo2/myshellScript.sh&quot;, passphrase , Wso2PathOut, Wso2PathIn];<br>var process = java.lang.Runtime.getRuntime().exec(command);process.waitFor();          <br>]]&gt;								<br>&lt;/script&gt;</pre><p>3. Create properties to populate the arguments.</p><pre>&lt;property name=&quot;Wso2PathIn&quot; value=&quot;/home/janaka/WSo2/Input.txt&quot; scope=&quot;default&quot; type=&quot;STRING&quot;/</pre><pre>&lt;property name=&quot;Wso2PathOut&quot; value=&quot;/home/janaka/WSo2/out.txt.gpg&quot; scope=&quot;default&quot; type=&quot;STRING&quot;/&gt;</pre><pre>&lt;property name=&quot;passphrase&quot; value=&quot;somevalue&quot; scope=&quot;default&quot; type=&quot;STRING&quot;/&gt;</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c117ae108733" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Publish-Subscribe with JMS (TIBCO EMS broker) using wso2 Enterprise Integrator]]></title>
            <link>https://bajpushpakumara.medium.com/publish-subscribe-with-jms-using-wso2-enterprise-integrator-b11e15a6d17f?source=rss-404b675a100e------2</link>
            <guid isPermaLink="false">https://medium.com/p/b11e15a6d17f</guid>
            <category><![CDATA[wso2-ei]]></category>
            <category><![CDATA[me]]></category>
            <category><![CDATA[jms]]></category>
            <category><![CDATA[tibcoems]]></category>
            <category><![CDATA[tibco]]></category>
            <dc:creator><![CDATA[janaka pushpakumara]]></dc:creator>
            <pubDate>Sat, 28 Aug 2021 13:38:30 GMT</pubDate>
            <atom:updated>2025-03-27T15:45:32.781Z</atom:updated>
            <content:encoded><![CDATA[<h4>Part 3 Integrating TIBCO Enterprise Message Service (EMS )</h4><h3>Part 3 Integrating TIBCO EMS broker</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*86ahRWU3Guigwau5byF-jA.png" /></figure><p><strong>Prerequisites</strong></p><ul><li>WSO2 Enterprise Integrator (WSO2 EI) is installed.</li><li>TIBCO Enterprise Message Service (TIBCO EMS ) is installed</li></ul><p>In this blog post, We are going to explain steps to configure the WSO2 EI with TIBCO enterprise message service and test a JMS Publisher and Consumer scenario.</p><ol><li>Install the TIBCO EMS server.</li><li>Starting the EMS server with the sample tibemsd.conf file.</li><li>Creating queue manager and queue in TIBCO EMS server.</li><li>Setting up the wso2 EI with both Publisher and consumer services.</li><li>Testing the Deployment.</li></ol><h3>1. <strong>Install the TIBCO EMS server.</strong></h3><p><a href="https://www.tibco.com/products/tibco-messaging/downloads">TIBCO Enterprise Message Service™- Community Edition</a> is available free of charge and is ideal for getting started with TIBCO Enterprise Message Service, developing prototypes and proof of concept implementations, going all the way up to small scale production deployments.</p><p>Download the EMS community edition from <a href="https://www.tibco.com/products/tibco-messaging/downloads">tibco.com</a> and the installation guide for the different OS is available in the <a href="https://docs.tibco.com/products/tibco-enterprise-message-service-latest">product documentation</a>.</p><ul><li>Extract the TIBCO EMS archive file into a temporary directory.</li><li>Navigate to the temporary directory and EMS server directory.</li></ul><pre>cd TIB_ems_8.6.0</pre><ul><li>Install the using the below command in Linux. ( Refer to the Installation guide in the <a href="https://docs.tibco.com/products/tibco-enterprise-message-service-latest">product documentation</a> for different OS )</li></ul><pre>for f in tar/*; do tar -xvf $f; done</pre><ul><li>Move the new local opt directory to the desired location on the machine (for example, root directory /opt). If /opt/tibco already exists, copy the local subdirectory opt/tibco/ems to /opt/tibco/ems. (You must have root privileges to write to the root / directory)</li></ul><p>Or you can run the while keeping the server in the same directory when developing.</p><h3>2. Starting the EMS server with the sample tibemsd.conf file.</h3><ul><li>Create a directory name <strong>datastore</strong> under /opt/tibco/ems/&lt;version_number&gt;samples/config/ directory</li><li>Update the tibemsd.conf file in the /opt/tibco/ems/&lt;version_number&gt;samples/config/ directory and add the correct absolute path for <strong>configuration files</strong> and <strong>persistent storage</strong></li></ul><figure><img alt="updated tibemsd.conf file" src="https://cdn-images-1.medium.com/max/683/1*XaFF379klMerarR_kL-PJw.png" /><figcaption>updated tibemsd.conf file</figcaption></figure><ul><li>On UNIX, complete the following steps: On the command line, navigate to the opt/tibco/ems/&lt;version_number&gt;/bin directory and enter the following command:</li></ul><pre>./tibemsd64 -config /opt/tibco/ems/&lt;version_number&gt;samples/config/tibemsd.conf</pre><h3>3. Creating queue manager and queue in TIBCO EMS server.</h3><p>You can use the TIBCO Enterprise Message Service Administration Tool to manage/view the connections, factories, etc. start it with the below command</p><pre>./bin/tibemsadmin64</pre><p>Then execute the <strong>connect</strong> command in order to connect to the EMS server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/893/1*F2YJ24p-ZRNUgaUVtnGMjA.png" /></figure><ul><li>Create queue (<strong>SMSStore</strong>) in the EMS server</li></ul><pre>create queue SMSStore</pre><ul><li>Create ConnectionFactory (<strong>WSO2EIQueueConnectionFactory</strong>)in EMS server</li></ul><pre>create factory WSO2EIQueueConnectionFactory queue url=tcp://localhost:7222 reconnect_attempt_delay=60000 reconnect_attempt_count=3</pre><p>You can see the Connection Factories been created in <strong>factories.conf</strong> file as below. You can create the Connection Factories by manually adding them into the above file too.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/476/1*7SJIaC2PyVp7HdDFSeNgoA.png" /><figcaption>WSO2EIQueueConnectionFactory</figcaption></figure><h3>4. Setting up the wso2 EI with both Publisher and consumer services.</h3><ul><li>Copy below Tibco JMS client related jars in tibco server /lib directory into &lt;EI_HOME&gt;/repository/components/extensions/ directory</li></ul><pre>jms-2.0.jar <br>tibemsd_sec.jar <br>tibjms.jar <br>tibjmsadmin.jar <br>tibjmsapps.jar <br>tibjmsufo.jar <br>tibrvjms.jar </pre><ul><li>Enable the Axis2 JMS sender and JMS receiver</li></ul><p>in the &lt;MI_HOME&gt;/conf/deployment.toml file for newer EI server versions.</p><pre>[[transport.jms.listener]]<br>name = &quot;myQueueConnectionFactory&quot;<br>parameter.initial_naming_factory = &quot;com.tibco.tibjms.naming.TibjmsInitialContextFactory&quot;<br>parameter.provider_url = &quot;tcp://localhost:7222&quot;<br>parameter.connection_factory_name = &quot;WSO2EIQueueConnectionFactory&quot;<br>parameter.connection_factory_type = &quot;queue&quot;</pre><pre>[[transport.jms.sender]]<br>name = &quot;myQueueConnectionFactory&quot;<br>parameter.initial_naming_factory = &quot;com.tibco.tibjms.naming.TibjmsInitialContextFactory&quot;<br>parameter.provider_url = &quot;tcp://localhost:7222&quot;<br>parameter.connection_factory_name = &quot;WSO2EIQueueConnectionFactory&quot;<br>parameter.connection_factory_type = &quot;queue&quot;</pre><p>in the &lt;EI_HOME&gt;/conf/axis2/axis2.xml file for old EI server versions.</p><pre><strong>JMS sender<br></strong>&lt;transportSender name=&quot;jms&quot; class=&quot;org.apache.axis2.transport.jms.JMSSender&quot;&gt;<br>    &lt;parameter name=&quot;myQueueConnectionFactory&quot; locked=&quot;false&quot;&gt;<br>        &lt;parameter name=&quot;java.naming.factory.initial&quot; locked=&quot;false&quot;&gt;com.tibco.tibjms.naming.TibjmsInitialContextFactory&lt;/parameter&gt;<br>        &lt;parameter name=&quot;java.naming.provider.url&quot; locked=&quot;false&quot;&gt;tcp://localhost:7222&lt;/parameter&gt;<br>        &lt;parameter name=&quot;transport.jms.ConnectionFactoryJNDIName&quot; locked=&quot;false&quot;&gt;WSO2EIQueueConnectionFactory&lt;/parameter&gt;<br>        &lt;parameter name=&quot;transport.jms.ConnectionFactoryType&quot; locked=&quot;false&quot;&gt;queue&lt;/parameter&gt;<br>    &lt;/parameter&gt;<br>&lt;/transportSender&gt;</pre><pre><strong>JMS receiver</strong></pre><pre>&lt;transportReceiver name=&quot;jms&quot; class=&quot;org.apache.axis2.transport.jms.JMSListener&quot;&gt;<br>    &lt;parameter name=&quot;myQueueConnectionFactory&quot; locked=&quot;false&quot;&gt;<br>        &lt;parameter name=&quot;java.naming.factory.initial&quot; locked=&quot;false&quot;&gt;com.tibco.tibjms.naming.TibjmsInitialContextFactory&lt;/parameter&gt;<br>        &lt;parameter name=&quot;java.naming.provider.url&quot; locked=&quot;false&quot;&gt;tcp://localhost:7222&lt;/parameter&gt;<br>        &lt;parameter name=&quot;transport.jms.ConnectionFactoryJNDIName&quot; locked=&quot;false&quot;&gt;WSO2EIQueueConnectionFactory&lt;/parameter&gt;<br>        &lt;parameter name=&quot;transport.jms.ConnectionFactoryType&quot; locked=&quot;false&quot;&gt;queue&lt;/parameter&gt;<br>    &lt;/parameter&gt;<br>&lt;/transportReceiver&gt;</pre><ul><li>JMS Publisher Proxy service</li></ul><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>&lt;proxy xmlns=&quot;<a href="http://ws.apache.org/ns/synapse">http://ws.apache.org/ns/synapse</a>&quot;<br>       name=&quot;JMSPublisherProxy&quot;<br>       startOnLoad=&quot;true&quot;<br>       statistics=&quot;disable&quot;<br>       trace=&quot;disable&quot;<br>       transports=&quot;http,https&quot;&gt;<br>   &lt;target&gt;<br>      &lt;inSequence&gt;<br>         &lt;property action=&quot;remove&quot; name=&quot;TRANSPORT_HEADERS&quot; scope=&quot;axis2&quot;/&gt;<br>         &lt;property name=&quot;OUT_ONLY&quot; scope=&quot;default&quot; type=&quot;STRING&quot; value=&quot;true&quot;/&gt;<br>         &lt;property name=&quot;TEST_JMS_HEADER&quot; scope=&quot;transport&quot; value=&quot;TEST.QUEUE&quot;/&gt;<br>         &lt;log level=&quot;custom&quot;&gt;<br>            &lt;property expression=&quot;$trp:TEST_JMS_HEADER&quot;<br>                      name=&quot;JMSPublisherProxy Set JMSHeader TEST_JMS_HEADER &quot;/&gt;<br>         &lt;/log&gt;<br>         &lt;log level=&quot;custom&quot;&gt;<br>            &lt;property name=&quot;JMSPublisherProxy&quot; value=&quot;Publishing the JMS message .... &quot;/&gt;<br>         &lt;/log&gt;<br>         &lt;call&gt;<br>            &lt;endpoint&gt;<br>               &lt;address uri=&quot;jms:/SMSStore?transport.jms.ConnectionFactory=myQueueConnectionFactory&amp;amp;transport.jms.DestinationType=queue&amp;amp;transport.jms.Destination=SMSStore&quot;/&gt;<br>            &lt;/endpoint&gt;<br>         &lt;/call&gt;<br>         &lt;log level=&quot;custom&quot;&gt;<br>            &lt;property name=&quot;JMSPublisherProxy&quot; value=&quot;JMS message published&quot;/&gt;<br>         &lt;/log&gt;<br>         &lt;respond/&gt;<br>      &lt;/inSequence&gt;<br>      &lt;outSequence&gt;<br>         &lt;send/&gt;<br>      &lt;/outSequence&gt;<br>   &lt;/target&gt;<br>   &lt;description/&gt;<br>&lt;/proxy&gt;</pre><ul><li>JMS Consumer Proxy service</li></ul><pre>&lt;proxy xmlns=&quot;<a href="http://ws.apache.org/ns/synapse">http://ws.apache.org/ns/synapse</a>&quot; name=&quot;JMSConsumerProxy&quot; transports=&quot;jms&quot; statistics=&quot;disable&quot; trace=&quot;disable&quot; startOnLoad=&quot;true&quot;&gt;<br>    &lt;target&gt;<br>        &lt;inSequence&gt;<br>            &lt;log level=&quot;full&quot;/&gt;<br>            &lt;log level=&quot;custom&quot;&gt;<br>                &lt;property name=&quot;JMSConsumerProxy get JMSHeader TEST_JMS_HEADER &quot; expression=&quot;$trp:TEST_JMS_HEADER&quot; /&gt;<br>            &lt;/log&gt;<br>            &lt;log level=&quot;custom&quot;&gt;<br>                &lt;property name=&quot;JMSConsumerProxy&quot; value=&quot;JMS message Consumed &quot;/&gt;<br>            &lt;/log&gt;<br>            &lt;drop/&gt;<br>        &lt;/inSequence&gt;<br>        &lt;outSequence&gt;<br>            &lt;send/&gt;<br>        &lt;/outSequence&gt;<br>    &lt;/target&gt;<br>    &lt;parameter name=&quot;transport.jms.ContentType&quot;&gt;<br>        &lt;rules&gt;<br>            &lt;jmsProperty&gt;contentType&lt;/jmsProperty&gt;<br>            &lt;default&gt;text/xml&lt;/default&gt;<br>        &lt;/rules&gt;<br>    &lt;/parameter&gt;<br>    &lt;parameter name=&quot;transport.jms.ConnectionFactory&quot;&gt;myQueueConnectionFactory&lt;/parameter&gt;<br>    &lt;parameter name=&quot;transport.jms.DestinationType&quot;&gt;queue&lt;/parameter&gt;<br>    &lt;parameter name=&quot;transport.jms.Destination&quot;&gt;SMSStore&lt;/parameter&gt;<br>    &lt;description/&gt;<br>&lt;/proxy&gt;</pre><h3>5. Testing the Deployment.</h3><ol><li>Start the wso2 integrator.</li></ol><pre>sh &lt;EI_HOME&gt;/bin/integrator.sh</pre><p>2. Invoke the JMS Publisher proxy using soap UI.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MUiwisE65Q4FNUqSgMnR8A.png" /></figure><p>Or curl command</p><pre>curl -X POST <a href="http://localhost:8290/services/JMSPublisherProxy">http://localhost:8290/services/JMSPublisherProxy</a> H &#39;content-type: application/xml&#39; -d &#39;&lt;a&gt;hello world&lt;/a&gt;&#39;</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b11e15a6d17f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Publish-Subscribe with JMS using wso2 Enterprise Integrator]]></title>
            <link>https://bajpushpakumara.medium.com/publish-subscribe-with-jms-using-wso2-enterprise-integrator-3121a6cbc3fa?source=rss-404b675a100e------2</link>
            <guid isPermaLink="false">https://medium.com/p/3121a6cbc3fa</guid>
            <category><![CDATA[wso2]]></category>
            <category><![CDATA[jms]]></category>
            <category><![CDATA[ibm-mq]]></category>
            <category><![CDATA[ibm]]></category>
            <category><![CDATA[enterprise-integration]]></category>
            <dc:creator><![CDATA[janaka pushpakumara]]></dc:creator>
            <pubDate>Tue, 25 Feb 2020 04:24:46 GMT</pubDate>
            <atom:updated>2025-06-12T07:15:43.905Z</atom:updated>
            <content:encoded><![CDATA[<h3>Publish-Subscribe with JMS ( IBM MQ ) using wso2 Enterprise Integrator</h3><h4>Part 2 integrating IBM MQ broker</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/932/1*DQzo7qL2oukDYZGuXxZ-JQ.png" /></figure><p><strong>Prerequisites</strong></p><ul><li>WSO2 Enterprise Integrator (WSO2 EI) is installed.</li><li>Docker is installed (Here we are using the WebSphere MQ docker image)</li></ul><p>In this Blog post, We are going to explain how to configure the WSO2 EI with IBM WebSphere MQ and test a JMS Publisher and Consumer scenario.</p><ol><li>Run the IBM WebSphere MQ in docker.</li><li>Creating queue manager, queue and channel in IBM WebSphere MQ.</li><li>Generating the .bindings file.</li><li>Setting up the wso2 EI with both Publisher and consumer services.</li><li>Testing the Deployment.</li></ol><h3>1. Run the IBM WebSphere MQ in docker.</h3><p>Lets pull the latest docker image of ibm/mq from the <a href="https://hub.docker.com/r/ibmcom/mq/tags">docker hub</a>. Execute the following command to pull the latest image.</p><pre>sudo docker pull ibmcom/mq:latest</pre><p>After downloading the image, you can list the image with the below command.</p><pre>sudo docker images</pre><p>Let&#39;s run the image in a container with the below command.</p><pre>sudo docker run   --env LICENSE=accept   --env MQ_QMGR_NAME=QM1 --env MQ_QMGR_NAME=<strong>QMWSO2EI</strong>  --publish 1414:1414   --publish 9443:9443   --detach   --volume qm1data:/mnt/mqm   ibmcom/mq</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9hv-XCHXoB76P41FqcPs6A.png" /></figure><p>After the starting the container, We can access the management ibm/mq web console.</p><p><a href="https://localhost:9443/ibmmq/console/login.html">https://localhost:9443/ibmmq/console/login.html</a></p><p>use the default user credentials (user: <strong>admin</strong> password: <strong>passw0rd )</strong> in Oder login to the web console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oOzk_YF_W_n-pzCB37lYXA.png" /></figure><p>We can see that the Queue Manager ‘<strong>QMWSO2EI</strong>’ has been created as we set the environment variable <em>MQ_QMGR_NAME=</em><strong><em>QMWSO2EI </em></strong>while we are starting the IBM MQ container with the above docker run command.</p><h3>2. Creating queue manager, queue and channel in IBM WebSphere MQ.</h3><p>First of all you need to download and install the IBM MQ explorer. In this example we are using the <a href="https://www.ibm.com/support/pages/ms0t-ibm-mq-explorer">IBM MQ Explorer V9.1.4</a></p><ul><li>Creating queue manager (QMWSO2EI)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sWZ4Di8qRoiIi8EjibkTMA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dTrdChismYsOq4iZk3tilg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DS6paXcGkhNVCeXThrWCQg.png" /></figure><p>In Oder to connect to the IBMMQ server lets use an existing Chanel, We can list all the existing channels from the IBMMQ <a href="https://localhost:9443/ibmmq/console/">web console</a> under <br>Channels on QMWSO2EI widgets. Here we have used DEV.ADMIN.SVRCONN channel.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WToAxo3WkrhqPo6jQn0XAQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Yvdoig3UHdW1ogNluM0Fkw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h4eeFR1qX5f94yK6U0pNOQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F-2OVj2nrfgSPOArzki4lQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4PdHdfsM21_tW3n7aD6NOw.png" /></figure><p>use the default credentials to complete the QM creating task. After finishing the process we can see the connection status updates to Connected as below form the IBM Explorer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XPneZu27cGF0M9na3mQkyA.png" /></figure><p>Also, we can see the corresponding channel status changed to Running from the IBMMQ <a href="https://localhost:9443/ibmmq/console/">web console</a> as below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/927/1*9dVFlcEf0ttyQI1T4i0UTw.png" /></figure><ul><li>Creating channel (WSO2EI.SVRCONN)</li></ul><p>Select Channels &gt;&gt; New &gt;&gt; Server-connection Channel</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1RU-7DzPd2smqpw5b8seRg.png" /></figure><p>In the next step, we need to select the existing channel object to copy the attribute to the new channel. Let&#39;s select the DEV.ADMIN.SVRCONN</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_qBR2zqcUO66ZNzA2GQ_yw.png" /></figure><p>Let&#39;s keep the default settings and finish the task. After that, we can see that the channel list has been updated with the newly created channel as below. Also, we can test the connection with the right-click options.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_lBn87kAp7JRITlO1HpNGg.png" /></figure><ul><li>Creating the queue ( SMSStore )</li></ul><p>Select Queues &gt;&gt; New &gt;&gt; Local queue …</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IlbqCodEfUuDOmn4_WfedA.png" /></figure><p>Let&#39;s keep the default settings and finish the task. After that, we can see that the queue list has been updated with the newly created queue name SMSStore as below. Also, we can browse the message queue with the right-click options.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SVFSx22OKSn5xtmM3uAaZg.png" /></figure><h3>3. Generating the .bindings file.</h3><p>Next, we need to generate the binding file which will be used by IBM MQ client libraries for JNDI Look-up. For that, we need to first create a directory where this binding file will be stored. I have created a directory named &lt;EI_HOME&gt;/conf/jndidirectory for this purpose.</p><p>Select JMS Administered Objects &gt;&gt; Add initial context …</p><p>Set JNDI namespace location as<strong> file system</strong> and update the path to save the <strong>.bindings</strong> file. Let&#39;s keep the default settings and finish the task.</p><ul><li>Create the Connection factory (WSO2EIQueueConnectionFactory)</li></ul><p>Select Connection Factories &gt;&gt; New &gt;&gt; Connection Factory</p><p>Update the name as WSO2EIQueueConnectionFactory and next, set the type as queue connection factory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vN_Jp9SLboqJckiwN-Lubg.png" /></figure><p>In the Next window it is necessary change the transport as client since we are going to connect the remote IMB MQ server through wso2 EI.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6YLMiHMKsBj_HeyhlGR7FA.png" /></figure><p><strong>On the final window, you should select the base QM and change the connection list values ( if you are using remote instance for IBMMQ server, update the IP address of the IBMMQ server ) Under the connections as below. </strong>then finish the task.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8A9EIFcbrRBxWjEg-uZseg.png" /></figure><ul><li>Set the Destination ( SMSStore )</li></ul><p>Select Destinations &gt;&gt; New &gt;&gt; Destination</p><p>Create the destination name SMSStore and set the type as a queue. On the final window, You need to update the Queue Manager and the Queue as below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QNTtHKSonyzaN1trLTWq3Q.png" /></figure><p>The final Context content of the administrative object looks like below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7_tN9GJrWutz7JvMauF6_A.png" /></figure><h3>4. Setting up the wso2 EI with both Publisher and consumer services.</h3><ul><li>Build the Client libraries and copy them to the EI</li></ul><p>You need to build the client libraries (wmq-client-x.x.x.x.jar)as per the <a href="https://mi.docs.wso2.com/en/latest/install-and-setup/setup/brokers/configure-with-ibm-webspheremq/#copying-ibm-websphere-mq-libraries">wso2 ei official documentation</a> and copy the,</p><pre>wmq-client-8.0.0.4.jar &gt;&gt;&gt; &lt;EI_HOME&gt;/dropins</pre><pre>jta-1.1.jar &gt;&gt;&gt; &lt;EI_HOME&gt;/lib</pre><ul><li>Enable the Axis2 JMS sender and JMS receiver</li></ul><p>in the &lt;MI_HOME&gt;/conf/deployment.toml file for newer EI server versions.</p><pre>[[transport.jms.listener]]<br>name = &quot;myQueueConnectionFactory&quot;<br>parameter.initial_naming_factory = &quot;com.sun.jndi.fscontext.RefFSContextFactory&quot;<br>parameter.provider_url = &quot;file:///home/janaka/WSo2/BLOG/wso2mi-1.2.0/conf/jndidirectory&quot;<br>parameter.connection_factory_name = &quot;WSO2EIQueueConnectionFactory&quot;<br>parameter.connection_factory_type = &quot;queue&quot;<br>parameter.username = &quot;admin&quot;<br>parameter.password = &quot;passw0rd&quot;</pre><pre>[[transport.jms.sender]]<br>name = &quot;myQueueConnectionFactory&quot;<br>parameter.initial_naming_factory = &quot;com.sun.jndi.fscontext.RefFSContextFactory&quot;<br>parameter.provider_url = &quot;file:///home/janaka/WSo2/BLOG/wso2mi-1.2.0/conf/jndidirectory&quot;<br>parameter.connection_factory_name = &quot;WSO2EIQueueConnectionFactory&quot;<br>parameter.connection_factory_type = &quot;queue&quot;<br>parameter.username = &quot;admin&quot;<br>parameter.password = &quot;passw0rd&quot;</pre><p>in the &lt;EI_HOME&gt;/conf/axis2/axis2.xml file for old EI server versions.</p><pre><strong>JMS sender</strong></pre><pre>&lt;transportSender name=&quot;jms&quot; class=&quot;org.apache.axis2.transport.jms.JMSSender&quot;&gt;<br>    &lt;parameter name=&quot;myQueueConnectionFactory&quot; locked=&quot;false&quot;&gt;<br>        &lt;parameter name=&quot;java.naming.factory.initial&quot; locked=&quot;false&quot;&gt;com.sun.jndi.fscontext.RefFSContextFactory&lt;/parameter&gt;<br>        &lt;parameter name=&quot;java.naming.provider.url&quot; locked=&quot;false&quot;&gt;file:///home/janaka/WSo2/BLOG/wso2ei-6.5.0/conf/jndidirectory/&lt;/parameter&gt;<br>        &lt;parameter name=&quot;transport.jms.ConnectionFactoryJNDIName&quot; locked=&quot;false&quot;&gt;WSO2EIQueueConnectionFactory&lt;/parameter&gt;<br>        &lt;parameter name=&quot;transport.jms.ConnectionFactoryType&quot; locked=&quot;false&quot;&gt;queue&lt;/parameter&gt;<br>        &lt;parameter name=&quot;transport.jms.UserName&quot; locked=&quot;false&quot;&gt;admin&lt;/parameter&gt;<br>        &lt;parameter name=&quot;transport.jms.Password&quot; locked=&quot;false&quot;&gt;passw0rd&lt;/parameter&gt;<br>    &lt;/parameter&gt;<br>&lt;/transportSender&gt;</pre><pre><strong>JMS receiver</strong></pre><pre>&lt;transportReceiver name=&quot;jms&quot; class=&quot;org.apache.axis2.transport.jms.JMSListener&quot;&gt;<br>    &lt;parameter name=&quot;myQueueConnectionFactory&quot; locked=&quot;false&quot;&gt;<br>        &lt;parameter name=&quot;java.naming.factory.initial&quot; locked=&quot;false&quot;&gt;com.sun.jndi.fscontext.RefFSContextFactory&lt;/parameter&gt;<br>        &lt;parameter name=&quot;java.naming.provider.url&quot; locked=&quot;false&quot;&gt;file:///home/janaka/WSo2/BLOG/wso2ei-6.5.0/conf/jndidirectory/&lt;/parameter&gt;<br>        &lt;parameter name=&quot;transport.jms.ConnectionFactoryJNDIName&quot; locked=&quot;false&quot;&gt;WSO2EIQueueConnectionFactory&lt;/parameter&gt;<br>        &lt;parameter name=&quot;transport.jms.ConnectionFactoryType&quot; locked=&quot;false&quot;&gt;queue&lt;/parameter&gt;<br>        &lt;parameter name=&quot;transport.jms.UserName&quot; locked=&quot;false&quot;&gt;admin&lt;/parameter&gt;<br>        &lt;parameter name=&quot;transport.jms.Password&quot; locked=&quot;false&quot;&gt;passw0rd&lt;/parameter&gt;<br>    &lt;/parameter&gt;<br>&lt;/transportReceiver&gt;</pre><ul><li>JMS Publisher Proxy service</li></ul><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>&lt;proxy xmlns=&quot;<a href="http://ws.apache.org/ns/synapse">http://ws.apache.org/ns/synapse</a>&quot;<br>       name=&quot;JMSPublisherProxy&quot;<br>       startOnLoad=&quot;true&quot;<br>       statistics=&quot;disable&quot;<br>       trace=&quot;disable&quot;<br>       transports=&quot;http,https&quot;&gt;<br>   &lt;target&gt;<br>      &lt;inSequence&gt;<br>         &lt;property action=&quot;remove&quot; name=&quot;TRANSPORT_HEADERS&quot; scope=&quot;axis2&quot;/&gt;<br>         &lt;property name=&quot;OUT_ONLY&quot; scope=&quot;default&quot; type=&quot;STRING&quot; value=&quot;true&quot;/&gt;<br>         &lt;property name=&quot;TEST_JMS_HEADER&quot; scope=&quot;transport&quot; value=&quot;TEST.QUEUE&quot;/&gt;<br>         &lt;log level=&quot;custom&quot;&gt;<br>            &lt;property expression=&quot;$trp:TEST_JMS_HEADER&quot;<br>                      name=&quot;JMSPublisherProxy Set JMSHeader TEST_JMS_HEADER &quot;/&gt;<br>         &lt;/log&gt;<br>         &lt;log level=&quot;custom&quot;&gt;<br>            &lt;property name=&quot;JMSPublisherProxy&quot; value=&quot;Publishing the JMS message .... &quot;/&gt;<br>         &lt;/log&gt;<br>         &lt;call&gt;<br>            &lt;endpoint&gt;<br>               &lt;address uri=&quot;jms:/SMSStore?transport.jms.ConnectionFactory=myQueueConnectionFactory&amp;amp;transport.jms.DestinationType=queue&amp;amp;transport.jms.Destination=SMSStore&quot;/&gt;<br>            &lt;/endpoint&gt;<br>         &lt;/call&gt;<br>         &lt;log level=&quot;custom&quot;&gt;<br>            &lt;property name=&quot;JMSPublisherProxy&quot; value=&quot;JMS message published&quot;/&gt;<br>         &lt;/log&gt;<br>         &lt;respond/&gt;<br>      &lt;/inSequence&gt;<br>      &lt;outSequence&gt;<br>         &lt;send/&gt;<br>      &lt;/outSequence&gt;<br>   &lt;/target&gt;<br>   &lt;description/&gt;<br>&lt;/proxy&gt;</pre><ul><li>JMS Consumer Proxy service</li></ul><pre>&lt;proxy xmlns=&quot;<a href="http://ws.apache.org/ns/synapse">http://ws.apache.org/ns/synapse</a>&quot; name=&quot;JMSConsumerProxy&quot; transports=&quot;jms&quot; statistics=&quot;disable&quot; trace=&quot;disable&quot; startOnLoad=&quot;true&quot;&gt;<br>    &lt;target&gt;<br>        &lt;inSequence&gt;<br>            &lt;log level=&quot;full&quot;/&gt;<br>            &lt;log level=&quot;custom&quot;&gt;<br>                &lt;property name=&quot;JMSConsumerProxy get JMSHeader TEST_JMS_HEADER &quot; expression=&quot;$trp:TEST_JMS_HEADER&quot; /&gt;<br>            &lt;/log&gt;<br>            &lt;log level=&quot;custom&quot;&gt;<br>                &lt;property name=&quot;JMSConsumerProxy&quot; value=&quot;JMS message Consumed &quot;/&gt;<br>            &lt;/log&gt;<br>            &lt;drop/&gt;<br>        &lt;/inSequence&gt;<br>        &lt;outSequence&gt;<br>            &lt;send/&gt;<br>        &lt;/outSequence&gt;<br>    &lt;/target&gt;<br>    &lt;parameter name=&quot;transport.jms.ContentType&quot;&gt;<br>        &lt;rules&gt;<br>            &lt;jmsProperty&gt;contentType&lt;/jmsProperty&gt;<br>            &lt;default&gt;application/xml&lt;/default&gt;<br>        &lt;/rules&gt;<br>    &lt;/parameter&gt;<br>    &lt;parameter name=&quot;transport.jms.ConnectionFactory&quot;&gt;myQueueConnectionFactory&lt;/parameter&gt;<br>    &lt;parameter name=&quot;transport.jms.DestinationType&quot;&gt;queue&lt;/parameter&gt;<br>    &lt;parameter name=&quot;transport.jms.Destination&quot;&gt;SMSStore&lt;/parameter&gt;<br>    &lt;description/&gt;<br>&lt;/proxy&gt;</pre><h3>5. Testing the Deployment.</h3><ol><li>Start the wso2 integrator.</li></ol><pre>sh &lt;EI_HOME&gt;/bin/integrator.sh -DportOffset=10</pre><p>We need to offset the port values since the IBMMQ is using the 9443 (default port of the carbon web console URL ) for the web console by default.</p><p>2. Invoke the JMS Publisher proxy using soap UI.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MUiwisE65Q4FNUqSgMnR8A.png" /></figure><p>Or curl command</p><pre>curl -X POST http://localhost:8290/services/JMSPublisherProxy H &#39;content-type: application/xml&#39; -d &#39;&lt;a&gt;hello world&lt;/a&gt;&#39;</pre><p>Kindly refer to the below documentations for more information.</p><p>[1] <a href="https://docs.wso2.com/display/EI610/Configure+with+IBM+WebSphere+MQ?src=sidebar">https://docs.wso2.com/display/EI610/Configure+with+IBM+WebSphere+MQ?src=sidebar</a></p><p>[2] <a href="https://medium.com/@jayawark/how-to-configure-ibm-mq-8-with-wso2-esb-4c54a66b07a6">https://medium.com/@jayawark/how-to-configure-ibm-mq-8-with-wso2-esb-4c54a66b07a6</a></p><p>Hope this example will help for the beginners :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3121a6cbc3fa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Publish-Subscribe with JMS using wso2 Enterprise Integrator]]></title>
            <link>https://bajpushpakumara.medium.com/publish-subscribe-with-jms-using-wso2-enterprise-integrator-14501ba335a?source=rss-404b675a100e------2</link>
            <guid isPermaLink="false">https://medium.com/p/14501ba335a</guid>
            <category><![CDATA[jms-transactions]]></category>
            <category><![CDATA[wso2-ei]]></category>
            <category><![CDATA[jms]]></category>
            <category><![CDATA[wso2-mb]]></category>
            <category><![CDATA[wso2]]></category>
            <dc:creator><![CDATA[janaka pushpakumara]]></dc:creator>
            <pubDate>Sun, 23 Feb 2020 13:09:33 GMT</pubDate>
            <atom:updated>2024-04-16T07:58:57.164Z</atom:updated>
            <content:encoded><![CDATA[<h3>Publish-Subscribe with JMS using wso2 Integrator ( EI / MI)</h3><h4>Part 1 <strong>integrating EI broker profile</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/935/1*JX7oatHYqM_1v2O_WeDQGw.png" /></figure><h3>Configure and setup EI</h3><ol><li>Configure JMSSender</li></ol><p>if you are using wso2 Enterprise integrator, add the JMS sender in &lt;EI_HOME&gt;/conf/axis2/axis2.xml</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/888/1*N3vINRJUkQ8GHfOqp9Dxtg.png" /></figure><p>if you are using Micro Integrator, add the JMS sender in &lt;MI_HOME&gt;/conf/deployment.toml</p><pre>[transport.jms]<br>sender_enable = true</pre><p>2. Configure JMSListener</p><p>if you are using wso2 Enterprise integrator, Configure JMSListener in &lt;EI_HOME&gt;/conf/axis2/axis2.xml</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kmWvR6BWUxHUSDiyzoFcCQ.png" /></figure><p>if you are using Micro Integrator, add the JMS sender in &lt;MI_HOME&gt;/conf/deployment.toml</p><pre>[[transport.jms.listener]]<br>name = &quot;myQueueConnectionFactory&quot;<br>parameter.initial_naming_factory = &quot;org.wso2.andes.jndi.PropertiesFileInitialContextFactory&quot;<br>parameter.provider_url = &quot;conf/jndi.properties&quot;<br>parameter.connection_factory_name = &quot;QueueConnectionFactory&quot;<br>parameter.connection_factory_type = &quot;queue&quot;<br><br>[transport.jndi.connection_factories]<br>&#39;connectionfactory.QueueConnectionFactory&#39; = &quot;amqp://admin:admin@clientID/carbon?brokerlist=&#39;tcp://localhost:5675&#39;&quot;<br>&#39;connectionfactory.TopicConnectionFactory&#39; = &quot;amqp://admin:admin@clientID/carbon?brokerlist=&#39;tcp://localhost:5675&#39;&quot;</pre><p>3. Deploy the Publisher proxy to the wso2 EI.</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>&lt;proxy xmlns=&quot;<a href="http://ws.apache.org/ns/synapse">http://ws.apache.org/ns/synapse</a>&quot;<br>       name=&quot;JMSPublisherProxy&quot;<br>       transports=&quot;http https&quot;<br>       startOnLoad=&quot;true&quot;&gt;<br>   &lt;description/&gt;<br>   &lt;target&gt;<br>      &lt;inSequence&gt;<br>         &lt;property name=&quot;TRANSPORT_HEADERS&quot; scope=&quot;axis2&quot; action=&quot;remove&quot;/&gt;<br>         &lt;property name=&quot;OUT_ONLY&quot; value=&quot;true&quot; scope=&quot;default&quot; type=&quot;STRING&quot;/&gt;<br>         &lt;!-- Set outgoing properties --&gt;<br>         &lt;property name=&quot;TEST_JMS_HEADER&quot; value=&quot;TEST.QUEUE&quot; scope=&quot;transport&quot;/&gt;<br>         &lt;log level=&quot;custom&quot;&gt;<br>            &lt;property name=&quot;JMSPublisherProxy Set JMSHeader TEST_JMS_HEADER &quot;<br>                      expression=&quot;$trp:TEST_JMS_HEADER&quot;/&gt;<br>         &lt;/log&gt;<br>         &lt;log level=&quot;custom&quot;&gt;<br>            &lt;property name=&quot;JMSPublisherProxy&quot; value=&quot;Publishing the JMS message .... &quot;/&gt;<br>         &lt;/log&gt;<br>         &lt;call&gt;<br>            &lt;endpoint&gt;<br>               &lt;address uri=&quot;jms:/SMSStore?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&amp;amp;java.naming.factory.initial=org.wso2.andes.jndi.PropertiesFileInitialContextFactory&amp;amp;java.naming.provider.url=conf/jndi.properties&amp;amp;transport.jms.DestinationType=queue&quot;/&gt;<br>            &lt;/endpoint&gt;<br>         &lt;/call&gt;<br>         &lt;log level=&quot;custom&quot;&gt;<br>            &lt;property name=&quot;JMSPublisherProxy&quot; value=&quot;JMS message published&quot;/&gt;<br>         &lt;/log&gt;<br>         &lt;respond/&gt;<br>      &lt;/inSequence&gt;<br>      &lt;outSequence&gt;<br>         &lt;send/&gt;<br>      &lt;/outSequence&gt;<br>   &lt;/target&gt;<br>&lt;/proxy&gt;</pre><p>4. Deploy the Consumer proxy to the wso2 EI.</p><pre>&lt;proxy xmlns=&quot;<a href="http://ws.apache.org/ns/synapse">http://ws.apache.org/ns/synapse</a>&quot; name=&quot;JMSConsumerProxy&quot; transports=&quot;jms&quot; statistics=&quot;disable&quot; trace=&quot;disable&quot; startOnLoad=&quot;true&quot;&gt;<br>    &lt;target&gt;<br>        &lt;inSequence&gt;<br>            &lt;log level=&quot;full&quot;/&gt;<br>            &lt;log level=&quot;custom&quot;&gt;<br>                &lt;property name=&quot;JMSConsumerProxy get JMSHeader TEST_JMS_HEADER &quot; expression=&quot;$trp:TEST_JMS_HEADER&quot; /&gt;<br>            &lt;/log&gt;<br>            &lt;log level=&quot;custom&quot;&gt;<br>                &lt;property name=&quot;JMSConsumerProxy&quot; value=&quot;JMS message Consumed &quot;/&gt;<br>            &lt;/log&gt;<br>            &lt;drop/&gt;<br>        &lt;/inSequence&gt;<br>        &lt;outSequence&gt;<br>            &lt;send/&gt;<br>        &lt;/outSequence&gt;<br>    &lt;/target&gt;<br>    &lt;parameter name=&quot;transport.jms.ContentType&quot;&gt;<br>        &lt;rules&gt;<br>            &lt;jmsProperty&gt;contentType&lt;/jmsProperty&gt;<br>            &lt;default&gt;text/xml&lt;/default&gt;<br>        &lt;/rules&gt;<br>    &lt;/parameter&gt;<br>    &lt;parameter name=&quot;transport.jms.ConnectionFactory&quot;&gt;myQueueConnectionFactory&lt;/parameter&gt;<br>    &lt;parameter name=&quot;transport.jms.DestinationType&quot;&gt;queue&lt;/parameter&gt;<br>    &lt;parameter name=&quot;transport.jms.Destination&quot;&gt;SMSStore&lt;/parameter&gt;<br>    &lt;description/&gt;<br>&lt;/proxy&gt;</pre><h3>Configure and setup wso2 EI broker profile</h3><ol><li>No additional configurations needed for EI broker profile since this is an simple publisher consumer scenario.</li></ol><h3>Testing the Deployment</h3><ol><li>Start the wso2 EI broker profile</li></ol><pre>sh &lt;EI_HOME&gt;/bin/broker.sh</pre><p>2. Start the wso2 integrator.</p><pre>sh &lt;EI_HOME&gt;/bin/integrator.sh</pre><p>3. If the connections between the EI and the MB are successfully connected, We could observe the below log in the broker carbon logs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X40vLC03aVuF0g-wuwGCuw.png" /></figure><p>4. Invoke the JMS Publisher proxy using soap UI.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y5BXfY7RH-V7XVX1W8Xamw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tTeOrSi1busYLORHn0Saxw.png" /></figure><p>5. We can see the below logs in the EI carbon log file while the message process through the publisher and consumer proxies.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eZz04LLBL5OjAtuTiNRyLw.png" /></figure><p>Kindly refer to the below documentations for more information.</p><p>[1] <a href="https://docs.wso2.com/display/EI650/Publish-Subscribe+with+JMS">https://docs.wso2.com/display/EI650/Publish-Subscribe+with+JMS</a></p><p>[2] <a href="https://docs.wso2.com/display/EI650/Configure+with+the+Broker+Profile">https://docs.wso2.com/display/EI650/Configure+with+the+Broker+Profile</a></p><p>Hope this example will help for the beginners :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=14501ba335a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Securing MySQL Connection and Connecting WSO2 Servers]]></title>
            <link>https://bajpushpakumara.medium.com/securing-mysql-connection-and-connecting-wso2-servers-7f053122419?source=rss-404b675a100e------2</link>
            <guid isPermaLink="false">https://medium.com/p/7f053122419</guid>
            <category><![CDATA[ssl]]></category>
            <dc:creator><![CDATA[janaka pushpakumara]]></dc:creator>
            <pubDate>Sun, 17 Nov 2019 14:18:31 GMT</pubDate>
            <atom:updated>2019-11-17T14:19:48.393Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Settingup MYSQL Server</strong></p><p>Execute the following commands to generate necessary keys and sign them.</p><pre><em>openssl genrsa 2048 &gt; ca-key.pem</em><br><em>openssl req -new -x509 -nodes -days 3600 -key ca-key.pem -out ca.pem</em><br><em>openssl req -newkey rsa:2048 -days 3600 -nodes -keyout server-key.pem -out server-req.pem</em><br><em>openssl rsa -in server-key.pem -out server-key.pem</em><br><em>openssl x509 -req -in server-req.pem -days 3600 -CA ca.pem -CAkey ca-key.pem -set_serial 01 -out server-cert.pem</em><br><em>openssl req -newkey rsa:2048 -days 3600 -nodes -keyout client-key.pem -out client-req.pem</em><br><em>openssl rsa -in client-key.pem -out client-key.pem</em><br><em>openssl x509 -req -in client-req.pem -days 3600 -CA ca.pem -CAkey ca-key.pem -set_serial 01 -out client-cert.pem</em></pre><p>If you wish to configure the SSL connection with the default certificates you can skip the above certificate creation steps. The default certificates can be found with the same names within the MySQL server.</p><p>Now open my.cnf and add the following configurations. Its located at <em>/etc/mysql/my.cnf</em> in Ubuntu.</p><pre><em>[mysqld]</em><br><em>ssl-ca=/etc/mysql/ca.pem</em><br><em>ssl-cert=/etc/mysql/server-cert.pem</em><br><em>ssl-key=/etc/mysql/server-key.pem</em></pre><p>Now restart MySQL server. You can use the following command to do this.</p><pre><em>sudo service mysql restart</em></pre><p>Now to check whether SSL certificates are properly set. Login to MySQL and execute the following query.</p><pre><em>SHOW VARIABLES LIKE &#39;%ssl%&#39;;</em></pre><p>The above query will give the below output.</p><pre>+---------------+----------------------------+<br>| Variable_name | Value                      |<br>+---------------+----------------------------+<br>| have_openssl  | YES                        |<br>| have_ssl      | YES                        |<br>| ssl_ca        | /etc/mysql/ca.pem          |<br>| ssl_capath    |                            |<br>| ssl_cert      | /etc/mysql/server-cert.pem |<br>| ssl_cipher    |                            |<br>| ssl_crl       |                            |<br>| ssl_crlpath   |                            |<br>| ssl_key       | /etc/mysql/server-key.pem  |<br>+---------------+----------------------------+</pre><h4>Settingup Wso2 Server</h4><p>Import ca and server certificates (which we have created when configuring MySQL) to the client-truststore of the WSO2 server. You can do this with the following commands.</p><pre><em>keytool -import -alias wso2qamysqlclient -file  &lt;PATH_FROM_ROOT&gt;/</em>ca.pem<em> -keystore repository/resources/security/client-truststore.jks</em></pre><pre><em>keytool -import -alias wso2qamysqlclient -file  &lt;PATH_FROM_ROOT&gt;/server-cert.pem -keystore repository/resources/security/client-truststore.jks</em></pre><p>Now specify the SSL parameters in the connection URL.</p><p>According to the MySQL connector documentation in <a href="https://dev.mysql.com/doc/connector-j/5.1/en/connector-j-reference-configuration-properties.html">[1]</a>, following JDBC URL parameters should be included in the JDBC Url to enable the SSL communication between MySQL server and the wso2 server.</p><pre>useSSL=true<br>requireSSL=true<br>clientCertificateKeyStoreUrl<br>clientCertificateKeyStorePassword</pre><p>Ex: JDBC url</p><pre>jdbc:mysql://&lt;HOST_NAME&gt;:&lt;PORT&gt;/wso2db?useSSL=true&amp;amp;requireSSL=true&amp;amp;clientCertificateKeyStoreUrl=file:&lt;WSO2_HOME&gt;/repository/resources/security/client-truststore.jks&amp;amp;clientCertificateKeyStorePassword=wso2carbon</pre><p>You can start the server. If everything is set properly, the server should start without errors.</p><h4>You can solve the below ERROR with the above JDBC url configuration</h4><pre><em>com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failurecom.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure</em></pre><pre><em>The last packet successfully received from the server was 7 milliseconds ago.  The last packet sent successfully to the server was 7 milliseconds ago.<br>            at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)<br>            at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)<br>            at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)<br>            at java.lang.reflect.Constructor.newInstance(Constructor.java:423)<br>            at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)<br>    .<br>    .<br>    .<br>    Caused by: javax.net.ssl.SSLHandshakeException: Received fatal alert: unknown_ca</em></pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7f053122419" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>