camel过滤json格式消息
来源:互联网 发布:韩国idol和演员 知乎 编辑:程序博客网 时间:2024/05/17 20:30
格式数据
{ "data": { "2-6": 1.1 }, "id": "yf-1", "c": 2}
camel配置文件如下
<?xml version="1.0" encoding="UTF-8"?><blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd"><camelContext xmlns="http://camel.apache.org/schema/blueprint"> <route autoStartup="true"><from uri="mqtt:adv?host=tcp://127.0.0.1:1883&userName=hnyfadmin&password=hnyfadmin&subscribeTopicNames=Samples"/> <filter> <jsonpath>$.[?(@.c == 2)]</jsonpath> <to uri="activemq:topic:did?username=hnyfadmin&password=hnyfadmin"/> </filter> <filter> <jsonpath>$.data[?(@.2-6 == 1.1)]</jsonpath> <to uri="activemq:topic:data?username=hnyfadmin&password=hnyfadmin"/> </filter> </route> </camelContext></blueprint>
第一个是只取c=2的消息
第二个是取data下面的’2-6’作为过滤条件
这里可以写多个filter,消息来了,会往每个filter都发送一份消息,是同步的
具体的jsonPath表达式参考 http://goessner.net/articles/JsonPath/
camel代码参考 http://camel.apache.org/jsonpath.html
阅读全文
0 0
- camel过滤json格式消息
- jms消息&camel
- ActiveMQ + Camel 实现消息路由
- ActiveMQ + Camel 实现消息路由
- iOS Apns推送消息Json格式
- 融云群组系统消息封装Json格式
- 消息过滤
- 消息过滤
- JSON过滤
- 关于apache camel的消息转发效率
- Activemq+Camel.xml简单配置消息分发
- Camel
- Camel
- Camel
- C# TCP客户端编程消息格式为JSON
- C# 将MSMQ消息转换成Json格式
- C# 将MSMQ消息转换成Json格式 【优化】
- C++发送消息格式为JSON的http请求
- @class和#import的区别
- JAVA设计模式之单例模式
- 双向链表
- [算法分析与设计] leetcode 每周一题: 554. Brick Wall
- Common API Some/IP 环境的搭建
- camel过滤json格式消息
- python接口自动化4-绕过验证码登录(cookie)
- 中心极限定理
- 物联网技术百花齐放 加快互联互通步伐
- 适配器模式
- ShaderWeaver使用教程-火焰制作
- 第五周实践项目7 后缀表达式
- PowerDesigner16不显示comment列结局记录
- Android四大组件之Service