从Websphere-MQ调用.EXE [英] Calling a .EXE from Websphere-MQ

查看:86
本文介绍了从Websphere-MQ调用.EXE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基于 MQ(Websphere 7)的后续跟踪持续存在消息发送到文件系统.

如何从MQ支持包(例如MA01中的Q实用程序)设置.exe程序以在每次收到消息时执行?可以在MQ Explorer中设置吗? (我们在Windows 2008/R2上使用7.0).

解决方案

有几种方法可以做到这一点.

  1. 在Windows的控制下设置该应用程序(因为您提到了QMgr在Windows上.)该应用程序将作为服务运行,并且具有恢复选项,可以在服务失败时重新启动该应用程序.将对应用程序进行编程(或在Q的情况下进行配置),以使用具有非常长等待时间的GET处理队列.当QMgr不可用时,需要一些其他的错误处理来做一些明智的事情.这对于将邮件复制到多个队列非常有用,但不适用于队列到文件,因为文件永远都不会关闭.
  2. 将应用程序作为WebSphere MQ服务运行.使用CONTRIL(QMGR)定义SERVICE对象会使MQ在QMgr引导时启动服务,而在QMgr关闭时停止服务.由于该服务是QMgr的子进程,因此无需担心在QMgr不可用时如何处理错误.
  3. 基于非零队列深度触发程序.定义描述要执行命令的过程对象,使用TRIGTYPE(FIRST)在队列上启用触发并运行触发监视器.每当队列的深度> 0并且没有打开的输入句柄时,流程对象就会触发并执行命令.您开始的事情必须知道如何解析命令行,因此,如果您拥有别人的可执行文件,最简单的操作就是使用脚本来启动它.该脚本分析触发消息并触发可执行文件.或者脚本可能会忽略触发消息,而仅运行exe.我通常使用Korn Shell或Perl,并且两者都可以在Windows上使用.

我写了一篇文章,展示了如何使用Q的触发版本来防止事件队列被填充.本文假设您希望队列保持最满状态,因此使用大约80%的深度进行触发.每当队列深度变为非零时,都可以使用相同的技术(通过更简单的实现)触发Q程序.

更新
可能应该已经链接了该文章. ;-)
任务:消息传递:使用循环队列简化管理和调试

This a follow-up based on MQ (Websphere 7) persist message to file system.

How do you set up an .exe program from an MQ support pack (such as the Q utility in MA01) to execute each time a message is received? Can this be setup in MQ Explorer? (We are using 7.0 on Windows 2008/R2).

解决方案

There are a few ways to do this.

  1. Set the application up under Windows control (since you mentioned the QMgr is on Windows.) The app would run as a service, with recovery options to restart it if the service fails. The application would be programmed (or configured in the case of Q) to process the queue using GETs with a VERY long wait period. Some additional error handling is required to do something sensible when the QMgr is not available. This works great for copying messages to multiple queues but isn't appropriate for queue-to-file since the file would never close.
  2. Run the application as a WebSphere MQ service. Defining the SERVICE object using CONTRIL(QMGR) causes MQ to start the service when the QMgr boots and stop it when the QMgr is shut down. Since the service is a child process of the QMgr, no need to worry about how to handle errors when the QMgr isn't available.
  3. Trigger the program based on non-zero queue depth. Define a process object describing the command to be executed, enable triggering on the queue with TRIGTYPE(FIRST) and run a trigger monitor. Whenever the queue has depth > 0 and no open input handles, the process object fires and executes the command. The thing you start must know how to parse the command line so the easiest thing to do if you have someone else's executable is use a script to start it. The script parses the trigger message and fires off the executable. Or perhaps the script ignores the trigger message and just runs the exe. I generally use Korn Shell or Perl and both are available on Windows.

I wrote an article showing how to keep event queues from filling using a triggered version of Q. The article assumes you want the queues to remain mostly full so uses triggering on depth of about 80%. The same techniques could be used (in a much simpler implementation, by the way) to fire off the Q program whenever the queue depth became non-zero.

UPDATE
Probably should have linked the article. ;-)
Mission:Messaging: Easing administration and debugging with circular queues

这篇关于从Websphere-MQ调用.EXE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆