标签: apache-camel

企业集成模式解决方案绘图工具

我想知道是否有任何绘图工具可用于根据EIP映射给定的用例解决方案.有一个可用于MS Visio的模板和一个用于OpenOffice的SVG替代方案.模板中的形状很好,但似乎不是演示文稿的最佳图形.有没有可用于绘制EIP的替代方案?提前致谢.

soa esb apache-camel enterprise-integration

6
推荐指数
2
解决办法
6030
查看次数

使用CXF-RS组件时,为什么我们使用<cxf:rsServer>而不是普通的<jaxrs:server>?

作为这个问题的后续,我仍然对如何正确使用CXF-RS组件感到困惑.

我很困惑为什么我们需要<cxf:rsServer>用于指定CXF-RS端点的标签(或者甚至是这样的概念?),当我可以<jaxrs:server>完全使用标签时.

这是Camel和CXF的配置XML:

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:jaxrs="http://cxf.apache.org/jaxrs"
    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://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd      
        http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
        http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd
        http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
        http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">

    <jaxrs:server id="userService" address="/users">
        <jaxrs:serviceBeans>
            <bean class="com.example.UserServiceNoop" />
        </jaxrs:serviceBeans>
        <jaxrs:providers>
            <bean class="org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider" />
        </jaxrs:providers>
    </jaxrs:server>

    <bean id="user" class="org.apache.camel.component.direct.DirectComponent" />

    <camel:camelContext id="someCamelContext">
        <camel:route id="userServiceRoute">
            <camel:from uri="cxfrs:bean:userService" />
            <camel:routingSlip>
                <camel:simple>user:${header.operationName}</camel:simple>
            </camel:routingSlip>
        </camel:route>

        <camel:route id="userServiceRetrieveUser">
            <from uri="user:retrieveUser" />
            <!-- Assume this is going to a useful Processor -->

        </camel:route>  
    </camel:camelContext>
</beans>
Run Code Online (Sandbox Code Playgroud)

UserService.java:

package com.example;

/* a bunch …
Run Code Online (Sandbox Code Playgroud)

java spring web-services apache-camel cxfrs

6
推荐指数
1
解决办法
3652
查看次数

apache camel s3组件 - 在前缀上指定后缀/正则表达式

我正在使用Apache Camel的aws s3组件.而且我只想使用扩展名为.txt的特定数据,如何实现?根据camel文档,它有一个前缀选项,在我的情况下不适合,因为我想根据扩展进行过滤.

TIA

regex amazon-s3 apache-camel

6
推荐指数
1
解决办法
1105
查看次数

如何坚持动态创建的驼峰路由?

我正在使用侦听"控制路径"的自定义处理器动态创建路由.它根据发送到控制路由的消息内容创建路由.它用于由另一个系统动态创建FTP /文件端点.

我在ServiceMix和Hawtio中使用Camel作为蓝图包来控制路由的状态(例如暂停它们).

它工作正常,但(逻辑上)如果重新启动camel上下文,则无法识别这些路由,因为没有持久路由配置.

有关如何坚持路线的最佳做法吗?

我正在考虑通过读取文件端点的目录结构或使用数据库来保留路由及其状态来重新创建路由.

java apache-camel blueprint-osgi

6
推荐指数
1
解决办法
588
查看次数

Apache Camel:Aws-S3使用者在连接池超时时启动失败

我正在使用AWS-S3使用者定期轮询S3上某个位置的文件.轮询一定时间之后,它会因为给出的异常而失败

Will try again at next poll. Caused by:[com.amazonaws.AmazonClientException - Unable to execute HTTP request:
Timeout waiting for connection from pool]
com.amazonaws.AmazonClientException: Unable to execute HTTP request:Timeout waiting for connection from pool
at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:376) ~[aws-java-sdk-1.5.5.jar:na]
at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:202) ~[aws-java-sdk-1.5.5.jar:na]
at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:3037) ~[aws-java-sdk-1.5.5.jar:na]
at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:3008) ~[aws-java-sdk-1.5.5.jar:na]
at com.amazonaws.services.s3.AmazonS3Client.listObjects(AmazonS3Client.java:531) ~[aws-java-sdk-1.5.5.jar:na]
at org.apache.camel.component.aws.s3.S3Consumer.poll(S3Consumer.java:69) ~[camel-aws-2.12.0.jar:2.12.0]
at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:187) [camel-core-2.12.0.jar:2.12.0]
at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:114) [camel-core-2.12.0.jar:2.12.0]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [na:1.7.0_60]
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304) [na:1.7.0_60]
Run Code Online (Sandbox Code Playgroud)

根据我的理解,原因是消费者耗尽了池中的可用连接,因为它在每次轮询时使用新连接.我需要知道的是如何在每次轮询后释放资源以及为什么组件本身不会这样做.

骆驼版:2.12

编辑:我修改了使用者以选择具有特定连接超时,maxconnections,maxerrorretry和sockettimeout的自定义S3客户端,但没有用.结果是一样的.

S3客户端配置:

ClientConfiguration clientConfiguration = new ClientConfiguration();
    clientConfiguration.setMaxConnections(50);
    clientConfiguration.setConnectionTimeout(6000);
    clientConfiguration.setMaxErrorRetry(3);
    clientConfiguration.setSocketTimeout(30000);
    main.bind("s3Client", new AmazonS3Client(awsCredentials, clientConfiguration));
Run Code Online (Sandbox Code Playgroud)

名为"s3Client"的AmazonS3Client对象与Camel上下文绑定,并提供给基于Camel …

java amazon-s3 apache-camel

6
推荐指数
1
解决办法
2152
查看次数

如何以最少的内存运行spring boot胖子?

这是我们的Maven MediSpan项目。实际上,这是一个RESTWeb服务。JSON通过GPI代码针对指定患者的“ 药物相互作用”查询的返回对象。这是一个剩余查询的示例:

http://localhost:8017/mspn/query?pid=1000&
gpis=83-20-00-30-20-03-10&gpis=64-99-10-02-12-03-20
Run Code Online (Sandbox Code Playgroud)

这是我们项目的结构:

/opt/java/spring/boot/fat/jar/project/chorke?mspn?server/
    ?? MediSpan.Documents.Monograph.css                   [     1,697 Byte]
    ?? MediSpan.Documents.Monograph.xslt                  [    35,167 Byte]
    ?? bitronix-tx-mgr-log-001                            [ 2,097,173 Byte]
    ?? bitronix-tx-mgr-log-002                            [ 2,097,173 Byte]
    ?? chorke?mspn?server.jar!                            [26,022,610 Byte]
        ?? medispan/                                      [   443,756 Byte]
        ?? META-INF/                                      [    33,702 Byte]
        ?? org/springframework/boot/loader/               [   165,003 Byte]
        ?? com/chorke/                                    [    27,633 Byte]
        ?? application.properties                         [       501 Byte]
        ?? application.yml                                [     2,234 Byte]
        ?? MediSpan.Foundation.Config.xml                 [    14,939 Byte]
        ?? MediSpan.Foundation.Text.xml                   [     9,003 Byte]
        ?? log4j.xml …
Run Code Online (Sandbox Code Playgroud)

java spring spring-mvc apache-camel spring-boot

6
推荐指数
1
解决办法
6302
查看次数

Camel路由无法生成随机UUID

我想在Camel路由中生成随机UUID.(骆驼版2.15.3)

我希望UUID对于每次路由运行都是不同的,即使路由运行两次而没有重新启动Camel上下文.我正在使用java.util.UUID(Java 1.8.0)生成随机UUID.

但是路由为每次路由运行生成相同的UUID,但是如果重新启动Camel上下文,则生成新的UUID.

骆驼路线:

import org.apache.camel.LoggingLevel;
import org.apache.camel.builder.RouteBuilder;

import java.util.UUID;

public class UuidLogger extends RouteBuilder {
    private final String loggerID = getClass().getName();

    @Override
    public void configure() throws Exception {
        from("direct:uuidLogger").routeId("uuidLogger")
                .log(LoggingLevel.INFO, loggerID, "UuidLogger triggered with $simple{body}, headers: $simple{headers}")
                .onException(Exception.class)
                    .log(LoggingLevel.ERROR, loggerID, "Fail: Exception. Body: $simple{body}, Headers: $simple{headers}, Stacktrace: $simple{exception.stacktrace}")
                    .handled(true)
                .end()
                .setBody(simple(UUID.randomUUID().toString()))
                .log(LoggingLevel.INFO, loggerID, "Generated UUID: $simple{body}")
                .to("mock:uuidLoggerMock")
                .log(LoggingLevel.INFO, loggerID, "UuidLogger done");
    }
}
Run Code Online (Sandbox Code Playgroud)

显示失败的JUnit测试:

import com.systematic.cura.integration.vans.common.UuidLogger;
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 UuidLoggerTest extends …
Run Code Online (Sandbox Code Playgroud)

java uuid apache-camel java-8

6
推荐指数
1
解决办法
2178
查看次数

用途和差异黑白Apache骆驼Kafka消费者URI选项消费者流vs消费者数

Apache Camel Kafka Consumer提供了称为“ consumerStreams”和“ consumersCount”的URI选项。

需要了解差异和使用场景,以及如何适应多分区Kafka主题消息的使用

apache-camel apache-kafka

6
推荐指数
2
解决办法
850
查看次数

如何使用camel将大文件发送到ActiveMQ

我正在尝试将一个X?-GB大文件作为流发送到ActiveMQ队列进行处理.

我知道ActiveMQ 支持流,camel-jms也是如此,但是我尝试在队列上设置的东西似乎没什么区别.唯一改变的是关闭流缓存结果是一个"流关闭"异常.

我愿意使用处理器或自定义类(只要资源得到清理),但这应该可以从蓝图中获得.如何通过camel-activemq正确处理大文件而不会出现OutOfMemoryError?

运用

  • ServiceMix的-7.0.0
  • 骆驼2.16.4
  • ActiveMQ的-5.14.3

这是我的骆驼蓝图

<?xml version="1.0" encoding="UTF-8"?>
<blueprint
xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"

    <!-- just calls exchange.setBody(exchange.getBody(InputStream.class)) -->    
    <bean id="toStreamBody" class="my.test.toInputStream"/>

    <!-- define a bean of type StreamCachingStrategy which CamelContext will automaticly use -->
    <bean id="streamStrategy" class="org.apache.camel.impl.DefaultStreamCachingStrategy">
        <property name="spoolDirectory" value="${java.io.tmpdir}TestTemp/#uuid#/"/>
        <property name="spoolThreshold" value="131072"/>
        <property name="spoolUsedHeapMemoryThreshold" value="70"/>
        <property name="anySpoolRules" value="true"/>
    </bean>

    <!-- streamCaching="true" is "not a valid attribute" -->
    <camelContext streamCache="true" xmlns="http://camel.apache.org/schema/blueprint">

        <route id="file_route">
            <from uri="file://FileUploadBin?delete=false&amp;moveFailed=.error"/>
            <!-- just calls exchange.setBody(exchange.getBody(InputStream.class)) -->
            <bean ref="toStreamBody"/>
            <to uri="activemq:queue:TestQ"/>
        </route> …
Run Code Online (Sandbox Code Playgroud)

java activemq-classic inputstream apache-camel apache-servicemix

6
推荐指数
1
解决办法
1230
查看次数

如何使用Apache Camel Netty4以异步模式通过已建立的TCP连接发回响应?

我正在消费者模式下使用Netty4组件(http://camel.apache.org/netty4.html)构建一个具有Apache Camel路由的微服务.所以,在我的微服务中,我正在构建的这条路由将通过TCP连接接收消息.为此,我这样做了:

@Override
public void configure() throws Exception {
 this.from("netty4:tcp://localhost:7000?textline=true&encoding=utf8")
   .process(new Processor() {
      @Override
      public void process(final Exchange exchange) throws Exception {
        log.info("[Processor] - Incoming Message -> {}", exchange.getIn().getBody(String.class));
      }
   }).to("bean:messageService");
}
Run Code Online (Sandbox Code Playgroud)

好吧,我正常收到这些消息.要测试,我使用telnet:

$ telnet localhost 7000
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
TheMessage
Run Code Online (Sandbox Code Playgroud)

问题是当我想将消息发送回在该路由中建立的同一TCP通道时.在同步模式下,我可以使用Exchange对象轻松完成.但是,在异步模式下,我不知道如何将消息发送回生产者.

接收并应发送消息的Spring Service是:

@Service
public class MessageService {

  private static final Logger log = LoggerFactory.getLogger(MessageService.class);

  private List<String> messageStore = new LinkedList<>();

  public void sendToTCP(final String message) {
    log.info("[Service] …
Run Code Online (Sandbox Code Playgroud)

java apache-camel netty spring-boot

6
推荐指数
1
解决办法
586
查看次数