1 Reply Latest reply on May 21, 2010 12:38 AM by Baerrach bonDierne

    Connecting to Weblogic Topic/Queues

    Baerrach bonDierne Newbie

      Hello,

       

      I need JBossESB to be able to read and write to JMS Topics and Queues that are on a WebLogic server.

       

      I haven't been able to work out how to do so and couldn't find any examples of the configuration needed.

       

      Is someone able to point me to the documentation that I have possibly overlooked?

       

      Cheers

      Bae

        • 1. Re: Connecting to Weblogic Topic/Queues
          Baerrach bonDierne Newbie

          I have used jboss-soa-p.4.3.0.

           

          I configured the maven pom.xml file to include the hacked weblogic.jar file (the internal exploded wars are deleted as jboss attempts to deploy them)

           

          <?xml version="1.0" encoding="UTF-8"?>
          <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
            <modelVersion>4.0.0</modelVersion>
            <groupId>internal.esb.poc.jboss</groupId>
            <artifactId>poc</artifactId>
            <version>1.0-SNAPSHOT</version>
            <packaging>jboss-esb</packaging>
            <name>ESB - JBoss</name>
            <properties>
              <org.jboss.esb.server.home>D:\A-ESB\jboss-soa-p.4.3.0\jboss-as</org.jboss.esb.server.home>
              <org.jboss.esb.server.config>dev</org.jboss.esb.server.config>
              <org.jboss.esb.server.server>${org.jboss.esb.server.home}/server/${org.jboss.esb.server.config}</org.jboss.esb.server.server>
              <org.jboss.esb.server.deploy.dir>${org.jboss.esb.server.server}/deploy</org.jboss.esb.server.deploy.dir>
              <weblogic-version>9.2.1</weblogic-version>
              <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
            </properties>
            <build>
              <defaultGoal>install</defaultGoal>
              <plugins>
                <plugin>
                  <groupId>org.codehaus.mojo</groupId>
                  <artifactId>jboss-packaging-maven-plugin</artifactId>
                  <version>2.1.1</version>
                  <!-- Enable packaging types and lifecycle bindings. -->
                  <extensions>true</extensions>
                </plugin>
              </plugins>
            </build>
            <dependencies>
              <!-- Any other dependencies here -->
              <dependency>
                <!-- This version has the internal war resources deleted out of the weblogic jar -->
                <groupId>weblogic</groupId>
                <artifactId>weblogic-hack</artifactId>
                <version>${weblogic-version}</version>
              </dependency>
              </dependencies>
            <profiles>
              <profile>
                <id>deploy</id>
                <build>
                  <plugins>
                    <plugin>
                      <artifactId>maven-antrun-plugin</artifactId>
                      <executions>
                        <execution>
                          <phase>install</phase>
                          <configuration>
                            <tasks>
                              <property name="esb.file.name" value="${artifactId}-${version}.esb" />
                              <property name="esb.file" location="${build.directory}/${esb.file.name}" />
                              <echo message="Deploying ${esb.file.name} to JBoss " />
                              <copy todir="${org.jboss.esb.server.deploy.dir}" file="${esb.file}" />
                            </tasks>
                          </configuration>
                          <goals>
                            <goal>run</goal>
                          </goals>
                        </execution>
                      </executions>
                    </plugin>
                  </plugins>
                </build>
              </profile>
              <profile>
                <id>undeploy</id>
                <build>
                  <defaultGoal>validate</defaultGoal>
                  <plugins>
                    <plugin>
                      <artifactId>maven-antrun-plugin</artifactId>
                      <executions>
                        <execution>
                          <phase>validate</phase>
                          <configuration>
                            <tasks>
                              <property name="esb.file.name" value="${artifactId}-${version}.esb" />
                              <echo message="Undeploying ${esb.file.name} from JBoss " />
                              <delete file="${org.jboss.esb.server.deploy.dir}/${esb.file.name}" />
                            </tasks>
                          </configuration>
                          <goals>
                            <goal>run</goal>
                          </goals>
                        </execution>
                      </executions>
                    </plugin>
                  </plugins>
                </build>
              </profile>
            </profiles>
          </project>
          

           

          Then the jboss-esb.xml needs a jms-provider in order to read messages and a service that listens to that provider.

           

          Writing messages uses a service with a JMSRouter route.

           

          <?xml version="1.0"?>
          <jbossesb parameterReloadSecs="5" xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd">
            <providers>
              <fs-provider name="PollerFileProvider">
                <fs-bus busid="pollerChannel">
                  <fs-message-filter directory="D:/A-ESB/workspace-jboss/poc/to_send" input-suffix=".xml" />
                </fs-bus>
              </fs-provider>
          
              <jms-provider name="WeblogicJmsProvider" connection-factory="JMSConnectionFactory" jndi-context-factory="weblogic.jndi.WLInitialContextFactory" jndi-URL="t3://localhost:7011">
                <jms-bus busid="fromChannel">
                  <jms-message-filter dest-name="TopicName" dest-type="TOPIC" />
                </jms-bus>
              </jms-provider>
            </providers>
          
            <services>
              <service category="Security" name="Wiretap" description="Wiretap service for receiving copies of messages" invmScope="GLOBAL">
                <actions mep="OneWay">
                  <action name="print">
                    <property name="message" value="Message Received on Wiretap" printfull="false" />
                    <property name="printfull" value="true" />
                  </action>
                </actions>
              </service>
          
              <service category="File" name="Poller" description="Polls for files being created in this directory and sends them to target service" invmScope="GLOBAL">
                <listeners>
                  <fs-listener busidref="pollerChannel" is-gateway="true" name="Poller" schedule-frequency="10">
                  </fs-listener>
                </listeners>
                <actions mep="OneWay">
                  <action name="transformFromByteArrayToString">
                    <property name="encoding" value="UTF-8" />
                  </action>
                  <action name="transform">
                    <property name="incoming-type" value="my.class.to.transform.file.to.object.ServiceRequest" />
                  </action>
                  <action name="wiretap">
                    <property name="destinations">
                      <route-to service-category="Security" service-name="Wiretap" />
                    </property>
                  </action>
                  <action name="routeAction">
                    <property name="destinations">
                      <route-to service-category="POC" service-name="Incoming" />
                    </property>
                  </action>
                </actions>
              </service>
          
              <service category="File" name="Sender" description="Messages received by this service are written into files in the specified directory">
                <actions mep="OneWay">
                  <action name="transform">
                  </action>
                  <action name="wiretap">
                    <property name="destinations">
                      <route-to service-category="Security" service-name="Wiretap" />
                    </property>
                  </action>
                </actions>
              </service>
          
              <service category="POC" name="Incoming" description="Messages to be sent to POC" invmScope="GLOBAL">
                <actions mep="OneWay">
                  <action name="wiretap">
                    <property name="destinations">
                      <route-to service-category="Security" service-name="Wiretap" />
                    </property>
                  </action>
                  <action name="route">
                    <property name="unwrap" value="true" />
                    <property name="jndi-context-factory" value="weblogic.jndi.WLInitialContextFactory" />
                    <property name="jndi-URL" value="t3://localhost:7011" />
                    <property name="jndi-pkg-prefix" value="" />
                    <property name="connection-factory" value="JMSConnectionFactory" />
                    <property name="jndiName" value="QueueName" />
                    <property name="message-prop-clientID" value="JBossId" />
                  </action>
                </actions>
              </service>
          
              <service category="POC" name="Outgoing" description="Messages to be received from POC" invmScope="GLOBAL">
                <listeners>
                  <jms-listener name="POC-Gateway" busidref="fromChannel" is-gateway="true" />
                </listeners>
                <actions mep="OneWay">
                  <action name="wiretap">
                    <property name="destinations">
                      <route-to service-category="Security" service-name="Wiretap" />
                    </property>
                  </action>
                  <action name="routeAction">
                    <property name="destinations">
                      <route-to service-category="File" service-name="Sender" />
                    </property>
                  </action>
                </actions>
              </service>
            </services>
          </jbossesb>
          

           

          After deploying this bundle to the ESB I was able to drop input files into the target directory, read them into the ESB and transform them into a Java Object, send them to the POC queue, wait for the response on the POC topic, transform the Java Object into a File in the received directory.

           

          I couldn't work out how to link the output file name to the input filename but it was good enough.