This is a simple example on howto create a event driven poll of a directory using Camel.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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>com.ullgren.pontus.demo</groupId> | |
<artifactId>scheduledroutepolicy</artifactId> | |
<version>1.0</version> | |
<name>Testing ScheduledRoutePolicy</name> | |
<packaging>jar</packaging> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.apache.camel.CamelContext; | |
import org.apache.camel.EndpointInject; | |
import org.apache.camel.RoutesBuilder; | |
import org.apache.camel.builder.RouteBuilder; | |
import org.apache.camel.component.mock.MockEndpoint; | |
import org.apache.camel.test.junit4.CamelTestSupport; | |
import org.junit.Test; | |
public class PollRootDirTest extends CamelTestSupport{ | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.mule.api.MuleMessage; | |
import org.mule.api.transformer.TransformerException; | |
import org.mule.api.transport.PropertyScope; | |
import org.mule.transformer.AbstractMessageTransformer; | |
public class InsertProperty extends AbstractMessageTransformer { | |
@Override | |
public Object transformMessage(MuleMessage message, String outputEncoding) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<mule xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" | |
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd | |
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd | |
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd "> | |
<flow name="testFlow1" doc:name="testFlow1"> | |
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" doc:name="HTTP"/> | |
<set-payload value="привет мир" doc:name="Set Payload" /> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.ullgren.pontus.camel; | |
import java.io.File; | |
import java.io.FileInputStream; | |
import java.io.FileOutputStream; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.nio.charset.Charset; | |
import java.util.zip.ZipEntry; | |
import java.util.zip.ZipInputStream; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.mule.api.MuleMessage; | |
import org.mule.api.routing.filter.Filter; | |
import org.springframework.beans.BeansException; | |
import org.springframework.context.ApplicationContext; | |
import org.springframework.context.ApplicationContextAware; | |
public class FilterProxy implements Filter, ApplicationContextAware { | |
private ApplicationContext context; | |
private String realFilterId; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Map; | |
import java.util.concurrent.ConcurrentHashMap; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.beans.factory.support.AbstractBeanFactory; | |
/** | |
* Helper bean to allow indirect access to properties loaded by Spring property placeholders. | |
* Code taken from StackOverflow (http://stackoverflow.com/a/17697586) | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Licensed to the soi-toolkit project under one or more | |
* contributor license agreements. See the NOTICE file distributed with | |
* this work for additional information regarding copyright ownership. | |
* The soi-toolkit project licenses this file to You under the Apache License, Version 2.0 | |
* (the "License"); you may not use this file except in compliance with | |
* the License. You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.redpill_linpro.mule.cache; | |
import java.io.NotSerializableException; | |
import java.io.Serializable; | |
import org.mule.DefaultMuleEvent; | |
import org.mule.DefaultMuleMessage; | |
import org.mule.api.MessagingException; | |
import org.mule.api.MuleEvent; | |
import org.mule.api.MuleEventKeyGenerator; |
OlderNewer