`
wangleifire
  • 浏览: 500115 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

camel入门 xmpp tcp 配置 之XmppSender

阅读更多

 

我这么厚道的把源代码贴回来,兄弟们是不是应该给点支持啊!

package testxmpp;

import org.apache.camel.CamelContext;
import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
import org.apache.camel.ExchangePattern;
import org.apache.camel.Message;
import org.apache.camel.Producer;
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.log4j.Logger;

public class XmppSender {   
    private static String getdepart = "<iq id='hg9kg-39' from='ball@192.168.1.20/Camel' type='get'>"
        +"<x xmlns='jabber:iq:getdepart' departed='0' updatetime='321321'/>"
        +    "</iq>" ;
        public static void main(String [] s){
           
        try{
        CamelContext context = new DefaultCamelContext();

        context.start();
        //?textline=true&sync=false"
        Endpoint endpoint = context.getEndpoint("mina:tcp://192.168.1.20:5201");

        Exchange exchange = (Exchange)endpoint.createExchange(ExchangePattern.InOut);

        Message in = exchange.getIn();
        in.setHeader("foo", "bar") ;
        in.setBody(getdepart);
        in.setMessageId("111") ;
       
        Logger.getLogger(XmppSender.class).info("foo = "+in.getHeader("foo")) ;
        Producer producer = endpoint.createProducer();

        producer.start();

        producer.process(exchange);

        Message out = exchange.getOut();

        System.out.println(out.getBody());

        producer.stop();

        context.stop();

        }catch(Throwable ex)
        {
            ex.printStackTrace();
        }

        } 
}

分享到:
评论
发表评论

文章已被作者锁定,不允许评论。

相关推荐

    spring-boot-camel-config:Spring Boot Camel配置快速入门

    使用ConfigMap和Secrets的Spring-Boot Camel快速入门本快速入门演示了如何使用Kubernetes ConfigMap和Secrets配置Spring-Boot应用程序。 路由会生成示例消息,这些示例消息将传递到通过src/main/resources/...

    Camel in action(camel实战)

    Apache Camel is a Java framework that lets you implement the standard enterprise integration patterns in a few lines of code. With a concise but sophisticated DSL you snap integration logic into your ...

    camel配置TIBCO-topic

    camel配置TIBCO-topic配置文件详解

    针对Java开发者的ApacheCamel入门指南

    在这篇文章中,我将提供一个Java语言(非Groovy)的ApacheCamel入门演示。首先创建一个Maven项目的pom.xml。在这里我们只用到了camel-core.jar包,实际上它提供了许多你可能用到的实用组件。出于日志记录的目的,我...

    [Camel实战].(Camel.in.Action).Claus.Ibsen&Jonathan;.Anstey.文字版

    中文名: Camel 实战 原名: Camel in Action 作者: Claus Ibsen Jonathan Anstey 资源格式: PDF 版本: 英文文字版/更新源代码 出版社: Manning书号: 9781935182368发行时间: 2010年12月 地区: 美国 语言: 英文 简介: ...

    ApacheCamel快速入门(中)

    接上文EndpointDirect用于在两个编排好的路由间实现Exchange消息的连接,上一个路由中由最后一个元素处理完的Exchange对象,将被发送至由Direct连接的下一个路由起始位置(http://camel.apache.org/direct.html)。...

    Camel_Camel3Camel6函数_

    Camel3 Camel6函数等matlab源代码

    ApacheCamel-JDBC

    ApacheCamel-JDBC Apache Camel JDBC组件 代码样例Demo

    ApacheCamel快速入门(上)

    在这个专题中,我们介绍了相当数量技术组件:Flume、Kafka、ActiveMQ、Rabbitmq、Zookeeper、Thrift、Netty、DUBBO等等,还包括本文要进行介绍的ApacheCamel。有的技术组件讲得比较深入,有的技术组件则是点到为止。...

    apache-camel-demo

    Apache Camel是一个基于规则路由和中介引擎,提供企业集成模式的Java对象(POJO)的实现,通过应用程序接口(或称为陈述式的Java领域特定语言(DSL))来配置路由和中介的规则。领域特定语言意味着Apache Camel支持你...

    Camel in Action.zip

    Apache Camel 作为集成项目的利器,针对应用集成场景的抽象出了一套消息交互模型,通过组件的方式进行第三方系统的接入,目前Apache Camel已经提供了300多种组件能够接入HTTP,JMS,TCP,WS-*,WebSocket 等多种传输...

    ApacheCamel快速入门(下)

    接上文动态循环路由的特点是开发人员可以通过条件表达式等方式,动态决定下一个路由位置。在下一路由位置处理完成后Exchange将被重新返回到路由判断点,并由动态循环路由再次做出新路径的判断。...

    Camel服务集成,服务编排操作文档

    Camel服务集成,服务编排操作文档

    spring-boot-camel-xml:一个快速入门,展示了如何将Spring Boot和camel与XML DSL以及Kubernetes或OpenShift一起使用

    本示例演示了如何通过Spring XML配置文件在Spring Boot中配置骆驼路线。 该应用程序利用Spring 批注通过类路径上的src / main / resources / spring / camel-context.xml文件加载Camel Context定义。 重要的 该...

    Apache Camel中文开发使用指南.zip

    Apache Camel 开发使用指南中文版

    ServiceMix Bundle Camel ActiveMQ环境搭建入门实例Demo

    本书适合入门学习,所有例子都有源码 1.Servicemix环境安装和配置 2.Eclipse开发环境安装搭建 3.用Bundle对应用组件模块化 4.Camel的应用和例子 Bundle之间的消息传递, Errorhandling 负载均衡 。。。。。。 5....

    Camel in Action ch1

    1: Meet Camel - FREE 2: Routing with Camel - AVAILABLE Part 2 Core Camel 3: Transforming Data with Camel - AVAILABLE 4: Using Beans with Camel - AVAILABLE 5: Error Handling - AVAILABLE 6:...

    大众点评开源软负载管理中间件 Camel.zip

    Camel 是大众点评开发的软负载一体解决方案,承担了F5硬负载层后的软负载工作。Camel已成为大众点评网络流量中必不可缺的一层。 关于Camel的部署及使用,请参考Camel in Action: 国内 国外 Camel在大众点评的...

    Camel实战中文版第四章.pdf

    Camel In Action一书第四章的中文版。

Global site tag (gtag.js) - Google Analytics