Thursday, July 2, 2015

Apache Camel Bridge for Active MQ to WebLogic JMS

Active MQ to WebLogic JMS Bridge with Apache Camel


Note the highlighted sections .

1.    Required Libraries

·        WebLogic Thin Client library jar
·        Camel libraries
·        Active mq libraries
·        Spring libraries
Gradle config file example

/*
 * This build file was auto generated by running the Gradle 'init' task
 * by 'CTank' at '6/30/15 8:45 AM' with Gradle 2.4
 *
 * This generated file contains a sample Java project to get you started.
 * For more details take a look at the Java Quickstart chapter in the Gradle
 * user guide available at http://gradle.org/docs/2.4/userguide/tutorial_java_projects.html
 */

// Apply the java plugin to add support for Java
apply plugin: 'java'
apply plugin: 'idea'

// In this section you declare where to find the dependencies of your project
repositories {
   
// Use 'jcenter' for resolving your dependencies.
    // You can declare any Maven/Ivy/file repository here.
   
jcenter()
}




// In this section you declare the dependencies for your production and test code
dependencies {
   
// The production code uses the SLF4J logging API at compile time
   
compile 'org.slf4j:slf4j-api:1.7.12'

   
//Spring
   
compile 'org.springframework:spring-webmvc:4.1.0.RELEASE'
   
compile 'org.springframework:spring-jdbc:4.1.0.RELEASE'
   
compile 'org.springframework:spring-jms:4.1.0.RELEASE'
   
compile 'org.hibernate:hibernate-core:4.3.9.Final'
   
compile 'org.springframework:spring-tx:4.1.0.RELEASE'
   
compile 'org.springframework:spring-orm:4.1.0.RELEASE'
   
compile 'org.springframework:spring-beans:4.1.0.RELEASE'
   
//logging
   
compile 'ch.qos.logback:logback-classic:1.1.2'
   
compile 'org.slf4j:slf4j-api:1.7.2'
   
compile 'log4j:log4j:1.2.17'
   
compile 'org.apache.commons:commons-io:1.3.2'
   
//groovy
   
compile group: 'org.codehaus.groovy', name: 'groovy-all', version:'2.3.10'
   
//ActiveMQ
   
compile 'org.apache.activemq:activemq-broker:5.10.0'
   
compile 'org.apache.activemq:activemq-client:5.10.0'
   
compile 'org.apache.activemq:activemq-console:5.10.0'
   
compile 'org.apache.activemq:activemq-jaas:5.10.0'
   
compile 'org.apache.activemq:activemq-kahadb-store:5.10.0'
   
compile 'org.apache.activemq:activemq-openwire-legacy:5.10.0'
   
compile 'org.apache.activemq:activemq-ra:5.1.0'
   
compile 'org.apache.activemq:activemq-spring:5.10.0'
   
compile 'org.apache.activemq:activemq-pool:5.10.0'
   
// Camel

   
compile 'org.apache.camel:camel-core:2.15.2'
   
compile 'org.apache.camel:camel-spring:2.15.2'
   
compile 'org.apache.camel:camel-jms:2.15.2'

//    compile 'org.apache.camel:camel-spring:2.15.0'
//    compile 'org.apache.camel:camel-jms:2.15.0'
//    compile 'org.apache.camel:camel-bundle:2.0-M3'


   
runtime files("${project.projectDir}/src/main/resources")

    compile fileTree(dir: 'lib', include: [' wlthint3client.jar'])

   
// Declare the dependency for your favourite test framework you want to use in your tests.
    // TestNG is also supported by the Gradle Test task. Just change the
    // testCompile dependency to testCompile 'org.testng:testng:6.8.1' and add
    // 'test.useTestNG()' to your build script.
   
testCompile 'junit:junit:4.12'
}

task execute(
type:JavaExec) {
    main = mainClass
    classpath = sourceSets.
main.runtimeClasspath
    systemProperty
'java.security.policy', "${project.projectDir}/project-java-security.policy"
}





2.    Sample WebLogic Configuraiton


WebLogic Managed Server Name : MS1
JMS Server : JMSServer-01
SubDeployment :   SystemModule-0
Connection Factory :    sample.ccs.cf
JMS Queue  : sample.ccs.inbox

Login name : weblogic
Password : weblogic1   [  You don’t need login password for non-secure configuration]

3.    Camel Spring Configuration

For sending a ping message to JMS Queue once every 6 seconds



  <beans xmlns="http://www.springframework.org/schema/beans"

       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

       xmlns:camel="http://camel.apache.org/schema/spring"

       xsi:schemaLocation="

       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd

       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">

  

  

    

    <camelContext xmlns="http://camel.apache.org/schema/spring">

        

        <route>

            <from uri="timer:foo?period=6s"/>

            <transform>

                <simple>Message at ${date:now:yyyy-MM-dd HH:mm:ss}</simple>

            </transform>

            <to uri="weblogic:queue:JMSServer-0/SystemModule-0!sample_contracts"/>

        </route>

  

  

    </camelContext>

  

    

    <bean id="wljndiTemplate" class="org.springframework.jndi.JndiTemplate">

        <property name="environment">

            <props>

                <prop key="java.naming.factory.initial">weblogic.jndi.WLInitialContextFactory</prop>

                <prop key="java.naming.provider.url">t3://localhost:7001</prop>

                <prop key="java.naming.security.authentication">simple</prop>

                <prop key="java.naming.security.principal">weblogic</prop>

                <prop key="java.naming.security.credentials">weblogic1</prop>

            </props>

        </property>

    </bean>

  

  

  

    <bean id="wlqueueConnectionFactory"

          class="org.springframework.jndi.JndiObjectFactoryBean">

        <property name="jndiTemplate">

            <ref bean="wljndiTemplate" />

        </property>

        <property name="jndiName">

            <value>sample.ccs.cf</value>

        </property>

    </bean>

  

    <bean id="wlsample_out_queue" class="org.springframework.jndi.JndiObjectFactoryBean">

        <property name="jndiTemplate">

            <ref bean="wljndiTemplate" />

        </property>

        <property name="jndiName">

            <value>sample.ccs.inbox</value>

        </property>

    </bean>

  

    <bean id="wlsample_out_queueTemplate" class="org.springframework.jms.core.JmsTemplate">

        <property name="connectionFactory">

            <ref bean="wlqueueConnectionFactory" />

        </property>

        <property name="defaultDestination" ref="wlsample_out_queue" />

        <property name="destinationResolver">

            <bean class="org.springframework.jms.support.destination.JndiDestinationResolver">

                <property name="jndiTemplate">

                    <ref bean="wljndiTemplate" />

                </property>

                <property name="cache">

                    <value>true</value>

                </property>

            </bean>

        </property>

        <property name="sessionTransacted" value="false" />

    </bean>

  

    <bean id="weblogicConfig"

          class="org.apache.camel.component.jms.JmsConfiguration">

        <property name="connectionFactory" ref="wlqueueConnectionFactory"/>

        <property name="concurrentConsumers" value="10"/>

    </bean>

  

    <bean id="weblogic"

          class="org.apache.camel.component.jms.JmsComponent">

        <property name="configuration" ref="weblogicConfig"/>

    </bean>

  </beans>

Tuesday, July 19, 2011

WLI - JPD SQL for Table

Create Table
CREATE TABLE JPD_PROCESS_ONE (
CG_ID VARCHAR2(768) NOT NULL,
LAST_ACCESS_TIME NUMBER(19,0),
CG_DATA BLOB,
CONSTRAINT PK_JPO PRIMARY kEY (CG_ID)
);

Uncovering weblogic encryption

Use the tool : weblogic.security.Encrypt
http://download.oracle.com/docs/cd/E13222_01/wls/docs81/admin_ref/utils17.html
encrypt
The weblogic.security.Encrypt utility encrypts cleartext strings for use with WebLogic Server. The utility uses the encryption service of the current directory, or the encryption service for a specified WebLogic Server domain root directory.
Note: An encrypted string must have been encrypted by the encryption service in the WebLogic Server domain where it will be used. If not, the server will not be able to decrypt the string.
You can only run the weblogic.security.Encrypt utility on a machine that has at least one server instance in a WebLogic Server domain; it cannot be run from a client.
Note: BEA Systems recommends running the utility in the Administration Server domain directory or on the machine hosting the Administration Server and specifying a domain root directory.
Syntax
java [ -Dweblogic.RootDirectory=dirname ] [ -Dweblogic.management.allowPasswordEcho=true ] weblogic.security.Encrypt [ password ]

Argument
Definition
weblogic.RootDirectory
Optional. WebLogic Server domain directory in which the encrypted string will be used. If not specified, the default domain root directory is the current directory (the directory in which the utility is being run).
weblogic.management.allowPasswordEcho
Optional. Allows echoing characters entered on the command line. weblogic.security.Encrypt expects that no-echo is available; if no-echo is not available, set this property to true.
password
Optional. Cleartext string to be encrypted. If omitted from the command line, you will be prompted to enter a password.

Examples
The utility returns an encrypted string using the encryption service of the domain located in the current directory.
java weblogic.security.Encrypt xxxxxx
{3DES}Rd39isn4LLuF884Ns
The utility returns an encrypted string using the encryption service of the specified domain location.
java -Dweblogic.RootDirectory=./mydomain weblogic.security.Encrypt xxxxxx
{3DES}hsikci118SKFnnw
The utility returns an encrypted string in the current directory, without echoing the password.
java weblogic.security.Encrypt
Password:
{3DES}12hsIIn56KKKs3

Monday, June 21, 2010

Oracle/Aqualogic Service Bus Interview Questions - Part 2 X Query

1. What dows FLOWR in XQuery terminology stand for ? For,Let,Order By,Where and Return are key words for writing XQuery Expressions. FLOWR stands for these key words .


2. How can you find out the tag name of an XML Element excluding the namespace? By using the local-name() Xpath function e.g.


For the Xml node <ns0:< span=""></ns0:<>Request xmlns:ns0=”blah blah”>abc local-name function will return ‘Request’


3. How do you specify namespace definitions in XQuery File? By using the ‘declare namespace ‘ statement.


4. How can you read external xml document in XQuery ? By Using the document() function


5. What does the Xquery expression ‘element xyz{“abc”}’ result into? It will result into xml element abc.


6. How can you avoid getting xquery transformation errors? By doing data validation before invoking the core xquery functions/constructs.


7. How can you concatenate Strings in Xquery ? By using the concat xquery function


8. How can you remove multiple newline ,space and tab characters from a string ? By using the normalize-space xquery function


9. How will you iterate over the child nodes of an xml node in XQuery? By using the for… expression.


10. How will you return a Boolean true value from xquery ? By using the true() function.


 

Wednesday, June 16, 2010

Oracle/Aqualogic Service Bus Interview Questions - Part 1 Service Bus


1. How can you generate File Based Events using Oracle Service Bus? Service Bus allows you to create Proxy Services that can poll to ftp and sftp servers . Create a Messaging Type Proxy Service and choose , ftp or sft as the protocol on transport configuration. 


2. How can you invoke an EJB method from Oracle Service Bus? EJBs can be invoked as Web Services by first registering a Business Service with ejb transport and then getting the WSDL from the Business Service.


3. How can you achieve parallel processing in Oracle Service Bus? Oracle Service bus has the Split Join capability. A request can be broken to multiple childs each of which can be processed parallel and the results can be joined and then sent to requester.


4. What is difference between a WSDL Proxy Service and Any SOAP Proxy service? Any SOAP proxy service can accept any payload that conforms to SOAP schema.


5. Can you interact directly with Database from Service Bus? Yes by using the BEA XQuery method execute-sql


6. How can you interact transaction ally with multiple EIS such as JMS EJB and DB in Service Bus? Invoke the Business Services and xqueries(for DB) representing the different EIS in the request pipeline


7. For a Proxy Service listening to a JMS Queue how can you ensure that the JMS Message is retried if an error occurs during processing? Use an XA JMS Connection factory in the jms url.


8. What purpose do the Stage components serve in Service Bus? They are the containers for actions. A stage is the smallest group to have its error handling


9. How can you jump control from one stage to next stage without using if then else logic? Use the Skip action


10. How can you end a Proxy flow without using if then else logic ? By using the Reply action