pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

Apache駱駝,RabbitMQ如何發送消息/對象

Apache camel,RabbitMQ how to send messages/objects(Apache駱駝,RabbitMQ如何發送消息/對象)
本文介紹了Apache駱駝,RabbitMQ如何發送消息/對象的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

我希望有人可以在這個問題上提供一些幫助.

I hope someone can provide some help on this matter.

我正在使用駱駝rabbitmq,出于測試目的,我試圖向隊列發送一條消息,我試圖在rabbitmq界面中顯示該消息,然后將其讀回.

I am using camel rabbitmq and for testing purpose I am trying to send a message to the queue, which I'm trying to display in rabbitmq interface and then also read it back.

但是我不能讓它工作.

我認為可行的是,我在 rabbitmq 管理界面的交換選項卡中創建了一個新的交換.在我的 java 代碼中,我將消息發送到該交換.執行代碼時,我可以在 Web 界面中看到一個峰值,表明已收到某些內容,但我看不到已收到的內容.當我嘗試閱讀時,我無法閱讀并收到以下錯誤:<在路由中: Route(route2)[[From[rabbitmq://192.168.59.103:5672/rt... 因為 Route route2 沒有輸出處理器.您需要向路由添加輸出,例如 to("log:foo").

What I believe works is that I created, in the exchange tab of rabbitmq management interface, a new exchange. In my java code I send the message to that exchange. When the code is executed, I can see a spike in the web interface showing that something has been received but I can't see what has been received. When I try to read, I can't read and get the following errror: < in route: Route(route2)[[From[rabbitmq://192.168.59.103:5672/rt... because of Route route2 has no output processors. You need to add outputs to the route such as to("log:foo").

誰能給我一個關于如何發送消息、在網絡交互中查看并閱讀的實際示例?任何顯示此過程的教程也將不勝感激.

Can someone provide me a practical example on how to send a message,see it in the web interace and also read it? any tutorial showing this process will be also appreciated.

謝謝

=================第二部分

================= SECOND PART

我現在遇到的錯誤如下:

The error I'm getting now is the following:

Caused by: com.rabbitmq.client.ShutdownSignalException: channel error; reason: {#method<channel.close>(reply-code=406, reply-text=PRECONDITION_FAILED - cannot redeclare exchange 'rhSearchExchange' in vhost '/' with different type, durable, internal or autodelete value, class-id=40, method-id=10), null, ""}
    at com.rabbitmq.utility.ValueOrException.getValue(ValueOrException.java:67)
    at com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:33)
    at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:343)
    at com.rabbitmq.client.impl.AMQChannel.privateRpc(AMQChannel.java:216)
    at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:118)
    ... 47 more

我有以下設置:

我收到此錯誤,我認為我的 URI 有問題,我必須定義一些我缺少的額外參數我的交換是直接類型的我的隊列是持久型我的 uri 是:rabbitmq://192.168.59.105:5672/rhSearchExchange?username=guest&password=guest&routingKey=rhSearchQueue

I get this error, I believe I’m doing something wrong with the URI and I have to define some extra parameters that I’m missing My exchange is of direct type My queue is of durable type And my uri is : rabbitmq://192.168.59.105:5672/rhSearchExchange?username=guest&password=guest&routingKey=rhSearchQueue

對此有何意見?

謝謝

推薦答案

所以我昨天能夠解決這個問題,我遇到了與您相同(或至少相似)的問題.

So I was able to figure this out yesterday, I had the same (or at least similar) problems you were having.

您在 RabbitMQ URI 中擁有的選項必須與創建您的交換所使用的選項完全匹配.例如,在我的配置中,我有一個名為 tasks 的交換器,它是一種直接類型,是持久的,并且沒有配置為自動刪除.請注意,rabbitmq 駱駝組件中自動刪除選項的默認值為 true.此外,我想使用路由鍵 camel 獲取消息.這意味著我的 rabbitmq URI 需要看起來像:

The options you have in the RabbitMQ URI must exactly match the options that your exchange was created with. For example, in my configuration, I had an exchange called tasks that was a direct type, was durable, and was not configured to autodelete. Note that the default value for the autodelete option in the rabbitmq camel component is true. Additionally, I wanted to get the messages with the routing key camel. That means my rabbitmq URI needed to look like:

rabbitmq:localhost:5672/tasks?username=guest&password=guest&autoDelete=false&routingKey=camel

此外,我想從一個名為 task_queue 的現有隊列中讀取數據,而不是讓 rabbitmq camel 組件聲明它自己的隊列.因此,我還需要添加一個額外的查詢參數,所以我的 rabbitmq URI 是

Additionally, I wanted to read from an existing queue, called task_queue rather than have the rabbitmq camel component declare it's own queue. Therefore, I also needed to add an additional query parameter, so my rabbitmq URI was

rabbitmq:localhost:5672/tasks?username=guest&password=guest&autoDelete=false&routingKey=camel&queue=task_queue

此配置對我有用.下面,我從配置交換和隊列并發送消息的代碼中添加了一些 Java 代碼片段,以及我的 Camel Route 配置.

This configuration worked for me. Below, I added some Java code snippets from the code that configures the exchange and queue and sends a message, and my Camel Route configuration.

rabbitConnFactory = new ConnectionFactory();
rabbitConnFactory.setHost("localhost");
final Connection conn = rabbitConnFactory.newConnection();
final Channel channel = conn.createChannel();

// declare a direct, durable, non autodelete exchange named 'tasks'    
channel.exchangeDeclare("tasks", "direct", true); 
// declare a durable, non exclusive, non autodelete queue named 'task_queue'
channel.queueDeclare("task_queue", true, false, false, null); 
// bind 'task_queue' to the 'tasks' exchange with the routing key 'camel'
channel.queueBind("task_queue", "tasks", "camel"); 

發送消息:

channel.basicPublish("tasks", "camel", MessageProperties.PERSISTENT_TEXT_PLAIN, "hello, world!".getBytes());

駱駝路線:

@Override
public void configure() throws Exception {
    from("rabbitmq:localhost:5672/tasks?username=guest&password=guest&autoDelete=false&routingKey=camel&queue=task_queue")
        .to("mock:result");
}

我希望這會有所幫助!

這篇關于Apache駱駝,RabbitMQ如何發送消息/對象的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Parsing an ISO 8601 string local date-time as if in UTC(解析 ISO 8601 字符串本地日期時間,就像在 UTC 中一樣)
How to convert Gregorian string to Gregorian Calendar?(如何將公歷字符串轉換為公歷?)
Java: What/where are the maximum and minimum values of a GregorianCalendar?(Java:GregorianCalendar 的最大值和最小值是什么/在哪里?)
Calendar to Date conversion for dates before 15 Oct 1582. Gregorian to Julian calendar switch(1582 年 10 月 15 日之前日期的日歷到日期轉換.公歷到儒略歷切換)
java Calendar setFirstDayOfWeek not working(java日歷setFirstDayOfWeek不起作用)
Java: getting current Day of the Week value(Java:獲取當前星期幾的值)
主站蜘蛛池模板: 皮带机-带式输送机价格-固定式胶带机生产厂家-河南坤威机械 | 照相馆预约系统,微信公众号摄影门店系统,影楼管理软件-盟百网络 | 蓄电池在线监测系统|SF6在线监控泄露报警系统-武汉中电通电力设备有限公司 | 细石混凝土泵_厂家_价格-烟台九达机械有限公司 | 复合肥,化肥厂,复合肥批发,化肥代理,复合肥品牌-红四方 | 禹城彩钢厂_钢结构板房_彩钢复合板-禹城泰瑞彩钢复合板加工厂 | 隧道风机_DWEX边墙风机_SDS射流风机-绍兴市上虞科瑞风机有限公司 | 菲希尔X射线测厚仪-菲希尔库伦法测厚仪-无锡骏展仪器有限责任公司 | 地图标注-手机导航电子地图如何标注-房地产商场地图标记【DiTuBiaoZhu.net】 | 超声波清洗机_超声波清洗机设备_超声波清洗机厂家_鼎泰恒胜 | 一级建造师培训_一建培训机构_中建云筑建造师培训网校 | 隧道风机_DWEX边墙风机_SDS射流风机-绍兴市上虞科瑞风机有限公司 | 圆周直径尺-小孔内视镜-纤维研磨刷-东莞市高腾达精密工具 | 储气罐,真空罐,缓冲罐,隔膜气压罐厂家批发价格,空压机储气罐规格型号-上海申容压力容器集团有限公司 | 垃圾处理设备_餐厨垃圾处理设备_厨余垃圾处理设备_果蔬垃圾处理设备-深圳市三盛环保科技有限公司 | 福建珂朗雅装饰材料有限公司「官方网站」 | 有机肥设备生产制造厂家,BB掺混肥搅拌机、复合肥设备生产线,有机肥料全部加工设备多少钱,对辊挤压造粒机,有机肥造粒设备 -- 郑州程翔重工机械有限公司 | 雨水收集系统厂家-雨水收集利用-模块雨水收集池-徐州博智环保科技有限公司 | 北京易通慧公司从事北京网站优化,北京网络推广、网站建设一站式服务商-北京网站优化公司 | 珠海白蚁防治_珠海灭鼠_珠海杀虫灭鼠_珠海灭蟑螂_珠海酒店消杀_珠海工厂杀虫灭鼠_立净虫控防治服务有限公司 | 沧州友城管业有限公司-内外涂塑钢管-大口径螺旋钢管-涂塑螺旋管-保温钢管生产厂家 | 阳光模拟试验箱_高低温试验箱_高低温冲击试验箱_快速温变试验箱|东莞市赛思检测设备有限公司 | 消防设施操作员考试报名时间,报名入口,报考条件 | ptc_浴霸_大巴_干衣机_呼吸机_毛巾架_电动车加热器-上海帕克 | 抓斗式清污机|螺杆式|卷扬式启闭机|底轴驱动钢坝|污水处理闸门-方源水利机械 | 欧景装饰设计工程有限公司-无锡欧景装饰官网 | 变位机,焊接变位机,焊接变位器,小型变位机,小型焊接变位机-济南上弘机电设备有限公司 | 大_小鼠elisa试剂盒-植物_人Elisa试剂盒-PCR荧光定量试剂盒-上海一研生物科技有限公司 | 全钢实验台,实验室工作台厂家-无锡市辰之航装饰材料有限公司 | 流量检测仪-气密性检测装置-密封性试验仪-东莞市奥图自动化科技有限公司 | 电气控制系统集成商-PLC控制柜变频控制柜-非标自动化定制-电气控制柜成套-NIDEC CT变频器-威肯自动化控制 | 礼仪庆典公司,礼仪策划公司,庆典公司,演出公司,演艺公司,年会酒会,生日寿宴,动工仪式,开工仪式,奠基典礼,商务会议,竣工落成,乔迁揭牌,签约启动-东莞市开门红文化传媒有限公司 | 海水晶,海水素,海水晶价格-潍坊滨海经济开发区强隆海水晶厂 | 生鲜配送系统-蔬菜食材配送管理系统-连锁餐饮订货配送软件-挪挪生鲜供应链管理软件 | 高温高压釜(氢化反应釜)百科| 工业淬火油烟净化器,北京油烟净化器厂家,热处理油烟净化器-北京众鑫百科 | 广州展览设计公司_展台设计搭建_展位设计装修公司-众派展览装饰 广州展览制作工厂—[优简]直营展台制作工厂_展会搭建资质齐全 | 丽陂特官网_手机信号屏蔽器_Wifi信号干扰器厂家_学校考场工厂会议室屏蔽仪 | 彩信群发_群发彩信软件_视频短信营销平台-达信通 | SDG吸附剂,SDG酸气吸附剂,干式酸性气体吸收剂生产厂家,超过20年生产使用经验。 - 富莱尔环保设备公司(原名天津市武清县环保设备厂) | 道康宁消泡剂-瓦克-大川进口消泡剂供应商 |