English 中文(简体)
在阿帕奇骆驼中嵌入持久性解决方案,以保存死信信息
原标题:Embedded Persistence solution in Apache Camel to save dead letter message
。 在大多数持久性元素中,您不会保存信息本身,但从中选择了(meta)数据(使用 DB4O组件的显著例外)。

例如,如果您在信息中发送 Hibernates 实体,您可以使用 Hibernate 组件 :

from("seda:deadMessageStore").
  setBody().groovy("new DeadMessageLog(request.headers, request.body) ").
  to("hibernate:com.foo.DeadMessageLog");
errorHandler(deadLetterChannel("seda:deadMessageStore"));

如果您无法预测您会向死字母队列发送哪类课程, 请考虑使用 < a href=" http:// camel. apache. org/ db4o. html" rel=“ nofollow” > DB4O 组件 < / a>。 DB4O 在这个问题上非常灵活, 因为它允许您在队列中存储任何 Java 对象( 没有明确的映射, 如 Hibernate 或 JPA ) 。

// store any Java object without transformations
errorHandler(deadLetterChannel("db4o:java.lang.Object"))

创建嵌入 DB40 容器非常简单:

ObjectContainer db = Db4oEmbedded.openFile(Db4oEmbedded.newConfiguration(), DB4OFILENAME);
问题回答

暂无回答




相关问题
Creating JMS Queues at runtime [closed]

I am working on an application where the app user can create / delete queues . Also , he would be able to move a message from 1 queue to another, delete a message , rearrange the messages in the ...

Extending ManagedPerformanceCounter

I have been trying to add my own performance counter, and I m unable to use this performance counter for my routes. Could anyone tell me how to use a custom performance counter instead of ...

Apache Camel with ActiveMQ clustering

I m trying to determine my options for clustering my ServiceMix 3.3.1/Camel 2.1/AMQ 5.3 application. I m performing high volume message processing and I need to cluster for high availability and ...

Using Camel 2.1 with Grails 1.2.1 - Classloading problem

I m trying to define a Camel context in my Grails application. resource.groovy: xmlns camel: http://camel.apache.org/schema/spring camel { camelContext(id: camelContext ) { } } Results ...

Apache camel without maven

I have a hard time finding documentation/tutorials or just getting a dependency overview without going into some spiralling maven-nightmare. I even have trouble getting the examples to work, as its ...

CamelContext.start() doesn t block

I want to run a simple Apache Camel example that copies files from one directory to another: CamelContext context = new DefaultCamelContext(); context.addRoutes(new RouteBuilder() { public void ...

热门标签