Apache Camel: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
 
(16 intermediate revisions by the same user not shown)
Line 1: Line 1:
==Route==
<source lang="java">
package org.chorke.academia.java.mllp.engine.route;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.spring.SpringRouteBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.chorke.academia.java.mllp.engine.beans.listener.LabScheduleListener;
@Component
public class ScheduleRoute extends SpringRouteBuilder {
    private static final Logger LOG = LoggerFactory.getLogger(ScheduleRoute.class);
   
    @Autowired
    LabScheduleListener scheduleListener;
    @Override
    public void configure() throws Exception {
        from("quartz2://lab/hl7v2/client/schedule?cron=*/1+*+*+*+*+?&trigger.timeZone=+8 UTC").routeId("labScheduleRoute")
        .process(new Processor() {
            @Override
            public void process(Exchange exchange) throws Exception {
                LOG.debug("Keep your exchange business here");
            }
        })
        .threads(1, 10).multicast()
        .bean(this.scheduleListener).log("lab/hl7v2/client/schedule");
    }
}
</source>
==Handler==
<source lang="java">
package org.chorke.academia.java.mllp.engine.beans.listener;
import org.apache.camel.Exchange;
import org.apache.camel.ExchangeException;
import org.apache.camel.Handler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@Component
public class LabScheduleListenerImpl implements LabScheduleListener {
    private static final Logger LOG = LoggerFactory.getLogger(LabScheduleListenerImpl.class);
   
    @Handler
    @Override
    public void listen(@ExchangeException Exception exception, Exchange exchange) throws Exception {
        LOG.info("Keep your LAB schedule business here");
    }
}
</source>
==References==
==References==
{|
{|
Line 7: Line 65:
* [https://github.com/apache/camel-spring-boot-examples Apache Camel Spring Boot Examples]
* [https://github.com/apache/camel-spring-boot-examples Apache Camel Spring Boot Examples]
* [https://camel.apache.org/components/2.x/mina2-component.html Apache Camel Mina2 Components]
* [https://camel.apache.org/components/2.x/mina2-component.html Apache Camel Mina2 Components]
* [https://camel.apache.org/manual/latest/oncompletion.html Apache Camel OnCompletion]
* [https://camel.apache.org/camel-spring-boot/3.7.x/mina-starter.html Apache Camel Mina2 Starter]
* [https://camel.apache.org/camel-spring-boot/3.7.x/mina-starter.html Apache Camel Mina2 Starter]
* [https://camel.apache.org/camel-spring-boot/3.7.x/hl7-starter.html Apache Camel HL7 Starter]
* [https://camel.apache.org/camel-spring-boot/3.7.x/hl7-starter.html Apache Camel HL7 Starter]
* [https://camel.apache.org/manual/latest/predicate.html Apache Camel Predicates]
* [https://camel.apache.org/manual/latest/lifecycle.html Apache Camel Lifecycle]
| valign="top" |
* [https://camel.apache.org/manual/latest/using-propertyplaceholder.html Apache Camel Property Placeholders]
* [https://camel.apache.org/manual/latest/spring-remoting.html Apache Camel Spring Remoting]
* [https://camel.apache.org/components/3.18.x/crypto-component.html Apache Camel Crypto (JCE)]
* [https://camel.apache.org/components/latest/mybatis-component.html Apache Camel MyBatis]
* [https://camel.apache.org/components/latest/mvel-component.html Apache Camel MVEL]
* [https://camel.apache.org/components/latest/mllp-component.html Apache Camel MLLP]
* [https://camel.apache.org/components/latest/seda-component.html Apache Camel SEDA]
* [https://camel.apache.org/components/latest/scp-component.html Apache Camel SCP]
* [https://camel.apache.org/components/latest/sql-component.html Apache Camel SQL]
* [https://camel.apache.org/components/latest/ssh-component.html Apache Camel SSH]
| valign="top" |
* [https://stackoverflow.com/questions/22296285/ Camel Request Reply using ActiveMQ]
* [https://camel.apache.org/components/next/eips/requestReply-eip.html Camel Request Reply using JMS]
* [https://camel.apache.org/components/3.18.x/spring-redis-component.html Apache Camel Spring Redis]
* [https://camel.apache.org/components/2.x/properties-component.html#_using_propertyinject Camel <code>@PropertyInject</code>]
* [[Spring Cloud OpenFeign]]
* [https://camel.apache.org/components/3.18.x/others/jasypt.html Apache Camel Jasypt]
* [[Spring Security]]
* [[Netflix Eureka]]
* [[Jasypt]]
* [[Redis]]


|-
| colspan="3" |
----
|-
| valign="top" |
| valign="top" |
* [https://dzone.com/articles/embed-mule4-into-spring-boot Mule 4 top on Spring Boot Application]
* [https://docs.mulesoft.com/mule-runtime/3.9/spring-application-contexts Mule 3.9 Spring Application Context]
* [https://docs.mulesoft.com/mule-runtime/4.4/mule-runtime-updates What’s New in Mule 4]
* [https://docs.mulesoft.com/mule-runtime/latest/ Mule Runtime]


| valign="top" |
| valign="top" |


|}
|}

Latest revision as of 06:49, 5 October 2022

Route

package org.chorke.academia.java.mllp.engine.route;

import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.spring.SpringRouteBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.chorke.academia.java.mllp.engine.beans.listener.LabScheduleListener;

@Component
public class ScheduleRoute extends SpringRouteBuilder {
    private static final Logger LOG = LoggerFactory.getLogger(ScheduleRoute.class);
    
    @Autowired
    LabScheduleListener scheduleListener;

    @Override
    public void configure() throws Exception {
        from("quartz2://lab/hl7v2/client/schedule?cron=*/1+*+*+*+*+?&trigger.timeZone=+8 UTC").routeId("labScheduleRoute")
        .process(new Processor() {
            @Override
            public void process(Exchange exchange) throws Exception {
                LOG.debug("Keep your exchange business here");
            }
        })
        .threads(1, 10).multicast()
        .bean(this.scheduleListener).log("lab/hl7v2/client/schedule");
    }
}

Handler

package org.chorke.academia.java.mllp.engine.beans.listener;

import org.apache.camel.Exchange;
import org.apache.camel.ExchangeException;
import org.apache.camel.Handler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

@Component
public class LabScheduleListenerImpl implements LabScheduleListener {
    private static final Logger LOG = LoggerFactory.getLogger(LabScheduleListenerImpl.class);
    
    @Handler
    @Override
    public void listen(@ExchangeException Exception exception, Exchange exchange) throws Exception {
        LOG.info("Keep your LAB schedule business here");
    }
}

References