Showing posts with label redhat fuse. Show all posts
Showing posts with label redhat fuse. Show all posts

Friday, October 15, 2021

How can I validate xsd using apache camel?

 <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"

       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:camel="http://camel.apache.org/schema/blueprint"
       xsi:schemaLocation="
       http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
       http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/spring/camel-blueprint.xsd">

  <camelContext xmlns="http://camel.apache.org/schema/blueprint">
      <route>
          <from uri="file:flights/data-in?noop=false"/>
          <doTry>
              <to uri="validator:file:flights/schema/flight.xsd"/>
              <to uri="file:flights/data-valid"/>
              <doCatch>
                  <exception>org.apache.camel.ValidationException</exception>
                  <to uri="file:flights/data-invalid"/>
              </doCatch>
              <!--
              <doFinally>
                  <to uri="file:test/src/data/finally"/>
              </doFinally>
              -->
          </doTry>
      </route>

  </camelContext>

</blueprint>

Ref: https://stackoverflow.com/questions/28263085/how-can-i-validate-xsd-using-apache-camel

Friday, April 23, 2021

Use Multicast to keep the request body

 In the Redhat Fuse, when we route to the target system( like API, Database) the body will be overwrite with the response for  target system. In case we want access the data from the request, we should use  Multicast.



With the route above, The request will duplicate  to 2 route ( _route2 and _route3 ) and merge  the response of those route to  it body ( it 's array of  responses ). So, because the _route2 just  echo the message then we can access the  origin request.
And we can access the merge  of those response like access the array
 



Friday, May 8, 2020

Redhat fuse - JMS for IBM MQ

Drap and drop the JMS componet


In properties of the JMS component, select tab Advance and input the connect  Factory( the connection factory have to begin with # . Ex: #connectionFactory)

Add com.ibm.mq.allclient.jar to classpath( com.ibm.mq.allclient.jar is provided by IBM MQ).

Click to tab Configuration and add 1 bean with same name for Connection Factory( ex: connectionFactory).


The JBOSS EAP must run with  standalone-full.xml profile.

Rehat fuse - JDBC

Drap and drop JDBC component to Design tab
Input URI: jdbc:[datasource] ex: ExampleDS
Click to tab Configuration and add 1 bean with name is datasource name( ex: ExampleDS).

Install and use xorg-server on macOS via Homebrew

  The instructions to install and use xorg-server on macOS via Homebrew: Install Homebrew (if you haven't already): /bin/bash -c ...