小编Mav*_*751的帖子

使用IBM MQ类从队列中浏览,读取和删除消息

我正在使用Eclipse的Java类编写一个简单的Java应用程序.

现在,我可以在不删除存储的消息的情况下浏览远程队列.
以下是阅读周期的代码:

MQQueueManager QMgr = new MQQueueManager(qManager); //<-- qManager is a String with the QMgr name

int openOptions = MQC.MQOO_FAIL_IF_QUIESCING | MQC.MQOO_INPUT_SHARED | MQC.MQOO_BROWSE;  

MQQueue queue = QMgr.accessQueue(queueName, openOptions);

MQMessage theMessage    = new MQMessage();
MQGetMessageOptions gmo = new MQGetMessageOptions();
    gmo.options=MQC.MQGMO_WAIT | MQC.MQGMO_BROWSE_FIRST;
    gmo.matchOptions=MQC.MQMO_NONE;
    gmo.waitInterval=5000;

boolean thereAreMessages=true;
while(thereAreMessages){
    try{
        //read the message          
        queue.get(theMessage,gmo);  
        //print the text            
        String msgText = theMessage.readString(theMessage.getMessageLength());
        System.out.println("msg text: "+msgText);

                 // <--- Solution code Here

        //move cursor to the next message               
        gmo.options = MQC.MQGMO_WAIT | MQC.MQGMO_BROWSE_NEXT;

    }catch(MQException …
Run Code Online (Sandbox Code Playgroud)

java queue ibm-mq

8
推荐指数
1
解决办法
4万
查看次数

使用 Java 的 MQ 类运行简单 jar 时出错

我是编程的新手Websphere MQ classes for Java
我决定按照这种方式编写一个小型应用程序,能够通过 TCP/IP 连接并读取队列中的消息。

遵循本指南:http://publib.boulder.ibm.com/infocenter/wmqv7/v7r0/index.jsp ?topic=%2Fcom.ibm.mq.csqzaw.doc%2Fja10410_.htm

在第 4 点,建议Websphere Client使用以下命令在 Windows 命令提示符上测试安装(版本:7.0.1.8):
java -Djava.library.path=library_path MQIVP
其中“library_path”对我来说是“C:\Program Files\IBM\WebSphere MQ\java\lib”

应用程序运行,我继续编写一个简单的程序,Eclipse IDE代码如下:

import com.ibm.mq.MQEnvironment;

public class MQtestMain {

    public static void main(String[] args) {

        System.out.println("main");

        new MQtestMain();
    }

    public MQtestMain(){

        System.out.println("MQtestMain");

        MQEnvironment.hostname = "my.host.name";
        MQEnvironment.channel = "my.channel";
        MQEnvironment.port = 1414;

    }

}
Run Code Online (Sandbox Code Playgroud)

它没有任何关系,只是一个测试,以确保一切设置正确。

我已经从“C:\Program Files\IBM\WebSphere MQ\java\lib”中设置了一个包含“com.ibm.mq.jar”和“com.ibm.mq.jmqi.jar”的自定义库,并且没有错误在编译时报告。

从它运行应用程序会Eclipse在控制台上正确打印出“main”和“MQtestMain”。

因此,我继续导出它:文件 > 导出 > 可运行 Jar
将“库处理”设置为“将所需的库打包到生成的 JAR 中”

不幸的是,如果我从 Windows 命令提示符运行该程序: …

java eclipse windows jar ibm-mq

3
推荐指数
1
解决办法
1万
查看次数

获取WebBrowser.NewWindow事件的URL

我正在尝试将新的Window事件重​​定向到新选项卡:

myWebBrowser.NewWindow += add_NewTab; 

//...

private void add_NewTab(object sender, CancelEventArgs e)
{ 
    WebBrowser thisWebBrowser = (WebBrowser)sender;
    e.Cancel = true; //should block the default browser to open a new window

    TabPage addedTabPage = new TabPage("redirected tab"); //create a new tab
    tabControl_webBrowsers.TabPages.Add(addedTabPage); //add the new tab to the TabControl
    WebBrowser addedWebBrowser = new WebBrowser() //create the new web browser inside the new tab
    {
        Parent = addedTabPage,
        Dock = DockStyle.Fill
    };

    addedWebBrowser.Navigate(thisWebBrowser.StatusText.ToString()); //set the new browser destination url
}
Run Code Online (Sandbox Code Playgroud)

我不确定使用WebBrowser.StatusText是获取新窗口网址的最佳方式(这对我测试过的每个网站都不起作用). …

c# browser new-window

3
推荐指数
1
解决办法
1万
查看次数

标签 统计

ibm-mq ×2

java ×2

browser ×1

c# ×1

eclipse ×1

jar ×1

new-window ×1

queue ×1

windows ×1