有关TIBCO RV的介绍资料几乎是一搜一大堆,但是相关的C#代码基本上还是空白没有的.

对于新手来说,需要使用TIBCO RV通常是比较困难的 ,需要学习一大堆的相关资料.

这里简单写一下C#代码实现发消息的过程.

首先需要安装,添加引用,

using TIBCO.Rendezvous;

然后其实就是简单4个步骤 ,即可把讯息发出去;

开启环境 ->实例化NetTransport ->生成需要发送的 Message->transport.Send(msg); 最后关闭环境;

            //开启环境;TIBCO.Rendezvous.Environment.Open();// 实例化一个用来发送讯息的NetTransport ;NetTransport transport = new NetTransport(service, network, daemon);// 实例化消息;Message msg = new Message();//消息主题;msg.SendSubject = subject;//添加消息内容字段msg.AddField(name1, value1);msg.AddField(name2, value2);// 发送出去transport.Send(msg);//关闭环境TIBCO.Rendezvous.Environment.Close();

下面给出官网的DEMO 文档代码 ;

相信这份文档会对初次接触TIBCO.Rendezvous 的开发者极大的帮助.

/// Copyright (c) 1998-$Date: 2013-12-20 07:48:17 -0800 (Fri, 20 Dec 2013) $ TIBCO Software Inc.
/// All rights reserved.
/// TIB/Rendezvous is protected under US Patent No. 5,187,787.
/// For more information, please contact:
/// TIBCO Software Inc., Palo Alto, California, USA
using System;
using System.Net;
using TIBCO.Rendezvous;namespace TIBCO.Rendezvous.Examples
{/// <summary>///  RendezvousSender - sample Rendezvous message publisher.///  This program publishes one or more string messages on a specified///  subject.  Both the subject and the message(s) must be supplied as///  command parameters.  Message(s) with embedded spaces should be quoted.///  A field named "DATA" will be created to hold the string in each///  message.///  ///  Optionally the user may specify communication parameters for ///  NetTransport constructor. If none are specified the following ///  defaults are used:///  ///  service     "rendezvous" or "7500/udp"///  network     the result of gethostname///  daemon      "tcp:7500"///    ///  Normally a listener such as tibrvlisten should be started first.///  ///  Examples:///  ///  Publish two messages on subject a.b.c and default parameters:///  RendezvousSender a.b.c "This is my first message" "This is my second message"///  ///  Publish a message on subject a.b.c using port 7566:///  RendezvousSender -service 7566 a.b.c message/// </summary>class SenderApplication{static string service = null;static string network = null;static string daemon = null;static int iterations = 1;const String FIELD_NAME = "DATA";/// <summary>/// The main entry point for the application./// </summary>[MTAThread]static void Main(string[] arguments){int argumentsCount = InitializeParameters(arguments);if (argumentsCount > (arguments.Length - 2)){Usage();}try{/* Create internal TIB/Rendezvous machinery */if (TIBCO.Rendezvous.Environment.IsIPM()){/** Prior to using the Rendezvous IPM library please read the appropriate* sections of the user guide to determine if IPM is the correct choice* for your application; it is likely not.** To use the shared Rendezvous IPM library in .NET on Windows,* first make sure it is located in your system path before the standard* Rendezvous library.** The IPM shared library can be found in %TIBRV_HOME%\bin\ipm.** The IPM static library can be found in %TIBRV_HOME%\lib\ipm.** To configure IPM you can do one of the following:** 1) Nothing, and accept the default IPM RV parameter values.** 2) Place a file named "tibrvipm.cfg" in your PATH, and have* IPM automatically read in configuration values.** 3) Call Environment.SetRVParameters, prior to Environment.Open:**   string[] parameters =*  new string[] {"-reliability", "3", "-reuse-port", "30000"};*   Environment.SetRVParameters(parameters);*   Environment.Open();** 4) Call Environment.Open(string pathname), and have IPM read* in the configuration values:**   Environment.Open(".\\tibrvipm.cfg");** An example configuration file, "tibrvipm.cfg", can be found in the* "%TIBRV_HOME%\examples\IPM" directory of the Rendezvous installation.**/TIBCO.Rendezvous.Environment.Open(".\\tibrvipm.cfg");}else{TIBCO.Rendezvous.Environment.Open();}}catch(RendezvousException exception){Console.Error.WriteLine("Failed to open Rendezvous Environment: {0}", exception.Message);Console.Error.WriteLine(exception.StackTrace);System.Environment.Exit(1);}// Create Network transportTransport transport = null;try{transport = new NetTransport(service, network, daemon);}catch (RendezvousException exception){Console.Error.WriteLine("Failed to create NetTransport:");Console.Error.WriteLine(exception.StackTrace);System.Environment.Exit(1);}// Create the messageMessage message = new Message();// Set send subject into the messagetry{message.SendSubject = arguments[argumentsCount++];}catch (RendezvousException exception) {Console.Error.WriteLine("Failed to set send subject:");Console.Error.WriteLine(exception.StackTrace);System.Environment.Exit(1);}try{// Send one message for each parameterwhile (argumentsCount < arguments.Length){Console.Out.WriteLine("Publishing: subject={0} \"{1}\"",message.SendSubject,arguments[argumentsCount]);message.AddField(FIELD_NAME, arguments[argumentsCount], 0);for (int i = 0; i < SenderApplication.iterations; i++){transport.Send(message);}argumentsCount++;}}catch (RendezvousException exception){Console.Error.WriteLine("Error sending a message:");Console.Error.WriteLine(exception.StackTrace);System.Environment.Exit(1);}// Close Environment, it will cleanup all underlying memory, destroy// transport and guarantee delivery.try{TIBCO.Rendezvous.Environment.Close();}catch(RendezvousException exception){              Console.Error.WriteLine("Exception dispatching default queue:");Console.Error.WriteLine(exception.StackTrace);System.Environment.Exit(1);}}static void Usage(){Console.Out.Write("Usage: RendezvousSender [-service service] [-network network]");Console.Out.Write("                        [-daemon daemon] <subject> <messages>");System.Environment.Exit(1);}static int InitializeParameters(string[] arguments){int i = 0;while(i < arguments.Length - 1 && arguments[i].StartsWith("-")){if (arguments[i].Equals("-service")){service = arguments[i+1];i += 2;}elseif (arguments[i].Equals("-network")){network = arguments[i+1];i += 2;}elseif (arguments[i].Equals("-daemon")){daemon = arguments[i+1];i += 2;}elseif (arguments[i].Equals("-iterations")){iterations = Int32.Parse(arguments[i+1]);i += 2;}elseUsage();}return i;}}
}

TIBCO.Rendezvous简单的发消息的过程相关推荐

  1. NodeJS 搭建一个本地的服务,实现一个简单的公屏发消息

    本 Chat 主要是写关于 Node.js 如何搭建一个本地的服务,然后做一个简单的可以发消息的功能. 安装 Express 安装 Nodemon 使用 Nodemon 安装 socket.io so ...

  2. 服务器端和客户端互发消息,Socket编程实现简单的服务器与客户端互发消息

    socket编程的大致步骤如下: 1.创建服务器端SocketServer,并定义SocketServer的监听端口; 2.ServerSocket调用accept( )方法,是指处于阻塞: 3.创建 ...

  3. TIBCO Rendezvous — 技术介绍

      http://blog.csdn.net/tiercel2008/article/details/6799952 TIBCO Rendezvous - 技术介绍 1.1.1.      TIBCO ...

  4. php如何制定跳转到app原生页面,js实现界面向原生界面发消息并跳转功能

    本文实例为大家分享了js界面向原生界面发消息并跳转的具体代码,供大家参考,具体内容如下 步骤一 在idea中,打开rn项目下的./Android/app,这个过程需要一点儿时间,可能还需要下载grad ...

  5. sip协议详解_SIP协议详解-INVITE消息发送过程

    SIP协议是VoIP中最重要的信令控制协议.SIP中第一件事情就是主叫发送INVITE给被叫,被叫响铃.本文从多角度详细描述INVITE消息发送的全过程. 一.阅读RFC权威描述 关于INVITE消息 ...

  6. python自动回复qq消息_基于python使用qqbot接入qq做一个简单的文字消息自动回复

    qqbot是一个免费开源的基于smartqq的python插件,如果默认安装有pip,则可以直接在命令行下执行:pip install qqbot安装qqbot,安装成功后可以在命令行输入qqbot ...

  7. mfc 按钮点第一下没触发消息 第二下才触发消息_34 详细干货 | 给回避型伴侣发消息,他们不回复,该怎么办?...

    "我想我大概是一个不值得被爱的小孩吧"这是所有回避型依恋者最真实的内心写照.他们在感情中(至少是前期阶段),通常是很难信任他人,因为过去的经验告诉他们:别人是不可能给我情感满足的, ...

  8. 高校老师因发消息爱打“???”被学生投诉,被学校撤职后反手上述获赔13万...

    一连打几个问号 "???",你在给别人发信息的时候会有这样的习惯吗? >>>> 最近,英国的一位高校讲师,就因为发信息太爱加问号"???" ...

  9. 服务器向客户机发信息,服务器如何主动给客户端发消息

    服务器如何主动给客户端发消息 内容精选 换一换 当出现以下问题时,可以参考本章节排查解决.可以直接访问后端业务,但是无法通过负载均衡访问后端业务.通过私网IP可以访问负载均衡,但是公网IP无法访问负载 ...

  10. RocketMQ入门到入土(六)发消息的时候选择queue的算法有哪些?

    精彩推荐 一百期Java面试题汇总 SpringBoot内容聚合 IntelliJ IDEA内容聚合 Mybatis内容聚合 接上一篇:RocketMQ入门到入土(五)消息持久化存储源码解析 一.说明 ...

最新文章

  1. ansible role中常代码块
  2. happens-before
  3. fixture.detectChange如何通过Angular zone执行其异步逻辑的
  4. python交换数组中的两个元素_[Python]华为面试题,交换两个数组的元素使之总和的差值最小。...
  5. idle显示出错信息 python_原来学Python最好的书是这一本?它在bookauthority里排名第三...
  6. [转载] Java标识符 数据类型 常量与变量
  7. 【Java】关键词梳理
  8. JAVA 手机号正则 工具类
  9. vue获取上传进度_vue通过input选取apk文件上传,显示进度条
  10. os10.10上versions崩溃的问题解决
  11. ong拼音汉字_汉语拼音ang-ong(教案)
  12. PDM中BOM管理技术的研究及其应用
  13. adobenbsp;dreamweavernbsp;cs5序列号不对,…
  14. python 大文件分片上传_Python实现大文件分片上传
  15. 买天文望远镜必看——已知望远镜焦距、相机画幅,求视场(附代码,实时更新)
  16. 系统设计-网关(一)
  17. 简单日志(公开日记)
  18. JZOJ5952. 【NOIP2018模拟11.5A组】凯旋而归
  19. 走一个青瓜风——青瓜鸡尾酒
  20. 模拟量使用计算机电缆,计算机电缆如何选型?附计算机电缆型号大全

热门文章

  1. SpringBoot Kafka工具类封装
  2. MS SQL2000个人版安装教程(图文教程)
  3. CDA-分角色用户查询
  4. 达叔926词汇pdf单词提取、保存
  5. Delphi Inputbox,InputQuery用法
  6. 柳传志:我从来软弱 但不摇摆不做改革牺牲品
  7. Sql中 update select结合更新
  8. 2018年个人学习计划总结
  9. wav转mp3,wav怎么转换成mp3?
  10. 《缠中说禅108课》32:走势的当下与投资者的思维方式