[转帖]Tuxedo事件订阅服务端_MQ, Tuxedo及OLTP讨论区_Weblogic技术|Tuxedo技术|中间件技术|Oracle论坛|JAVA论坛|Linux/Unix技术|hadoop论坛_联动北方技术论坛  
网站首页 | 关于我们 | 服务中心 | 经验交流 | 公司荣誉 | 成功案例 | 合作伙伴 | 联系我们 |
联动北方-国内领先的云技术服务提供商
»  游客             当前位置:  论坛首页 »  自由讨论区 »  MQ, Tuxedo及OLTP讨论区 »
总帖数
1
每页帖数
101/1页1
返回列表
0
发起投票  发起投票 发新帖子
查看: 4173 | 回复: 0   主题: [转帖]Tuxedo事件订阅服务端        下一篇 
ulee@land
注册用户
等级:上尉
经验:769
发帖:55
精华:1
注册:2012-12-17
状态:离线
发送短消息息给ulee@land 加好友    发送短消息息给ulee@land 发消息
发表于: IP:您无权察看 2012-12-24 15:09:28 | [全部帖] [楼主帖] 楼主

北京联动北方科技有限公司TUXEDO 事件订阅服务端 北京联动北方科技有限公司

    1.#include <stdio.h> 

2.#include "atmi.h"        

3. 

4. 

5. 

6. 

7.void _TMDLLENTRY myfunc(char *buffer,long len,long flag) 

8.{ 

9.    long len2; 

10. char buftype[20],subtype[20];
11. if ((len2=tptypes(buffer,buftype,subtype))<0)
12. {
      13. printf("invalid buffer receive;\n");
14. }
15. else if(!strcmp(buftype,"STRING"))
16. {
      17. printf("unsolicited message from server\n:%s\n",buffer);
18. }
19. else if(!strcmp(buftype,"FML"))
20. {
      21. printf("unsolicited message from server:\n");
      22. Fprint(buffer);
23. }
24. else
25. printf("cannot print out buffer\n");
26.
27.}
28.
29.
30.
31.#if defined(__STDC__) || defined(__cplusplus)
32.main(int argc, char *argv[])
33.#else
34.main(argc, argv)
35.int argc;
36.char *argv[];
37.#endif
38.
39.{
      40.
      41. char *sendbuf, *rcvbuf;
      42. long sendlen, rcvlen;
      43. int ret;
      44. TPEVCTL evctl;
      45. int sub_serv=0;
      46.
      47.
      48.
      49. if(argc != 2) {
            50. (void) fprintf(stderr, "Usage: simpcl money\n");
            51. exit(1);
      52. }
      53.
      54.
      55. if (tpinit((TPINIT *) NULL) == -1) {
            56. (void) fprintf(stderr, "Tpinit failed\n");
            57. exit(1);
      58. }
      59. sendlen = strlen(argv[1]);
      60. if((sendbuf = (char *) tpalloc("STRING", NULL, sendlen+1)) == NULL) {
            61. (void) fprintf(stderr,"Error allocating send buffer\n");
            62. tpterm();
            63. exit(1);
      64. }
      65.
      66. if((rcvbuf = (char *) tpalloc("STRING", NULL, sendlen+1)) == NULL) {
            67. (void) fprintf(stderr,"Error allocating receive buffer\n");
            68. tpfree(sendbuf);
            69. tpterm();
            70. exit(1);
      71. }
      72. if(tpsetunsol(myfunc)== TPUNSOLERR)
      73. {
            74. printf("tpsetunsol() failure:%s\n",tpstrerror(tperrno));
            75. tpfree(sendbuf);
            76. tpfree(rcvbuf);
            77. tpterm();
            78. exit(1);
      79. }
      80. //sub_serv=tpsubscribe(eventexpr,filter,(TPEVCTL *)NULL,TPSIGRSTRT);
      81. evctl.flags = TPEVSERVICE;
      82. strcpy(evctl.name1,"CLIENT");
      83. sub_serv=tpsubscribe("BANK_TLR_WITHDRAWAL",NULL,(TPEVCTL *)NULL,TPSIGRSTRT);
      84. if (sub_serv==-1L)
      85. {
            86. printf("tpsubscribe() failure:%s\n",tpstrerror(tperrno));
            87. tpfree(sendbuf);
            88. tpfree(rcvbuf);
            89. tpterm () ;
            90. exit(1);
      91. }
      92. else
      93. printf("tpsubscribe(BANK_TLR_WITHDRAWAL) success\n");
      94.
      95. (void) strcpy(sendbuf, argv[1]);
      96. ret = tpcall("WITHDRAWAL", (char *)sendbuf, 0, (char **)&rcvbuf, &rcvlen, (long)0);
      97. if(ret == -1) {
            98. (void) fprintf(stderr, "tpcall(WITHDRAWAL) failure:%s\n",tpstrerror(tperrno));
            99. tpfree(sendbuf);
            100. tpfree(rcvbuf);
            101. tpterm();
            102. exit(1);
      103. }
      104. (void) fprintf(stdout, "Returned string is: %s\n", rcvbuf);
      105. if (tpunsubscribe(sub_serv,TPSIGRSTRT)==-1)
      106. printf("tpunsubscribe():%s\n",tpstrerror(tperrno));
      107.
      108. tpfree(sendbuf);
      109. tpfree(rcvbuf);
      110. tpterm();
      111. return(0);
112.}




赞(0)    操作        顶端 
总帖数
1
每页帖数
101/1页1
返回列表
发新帖子
请输入验证码: 点击刷新验证码
您需要登录后才可以回帖 登录 | 注册
技术讨论