JAVA-JMS,浏览大型短信时速度较慢 [英] JAVA - jms, slow browsing on large text messages

查看:106
本文介绍了JAVA-JMS,浏览大型短信时速度较慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在提升jms浏览器方面遇到一些问题. 我只需要浏览和显示te消息的标题信息,但是当我在带有大量大text \ xml消息的Q上浏览时,浏览器运行得非常慢,我认为这取决于消息正文的大小,但是我不需要身体.

i have some problem to boost my jms browser. I need to browse and display ONLY header information of te messages, but when i browsing on a Q with a lot of large text\xml messages the browser run very slow, i think it's depend by the size of the messages body but i dont need the body.

问题:是否有办法仅从消息枚举器中获取标头信息?

QUESTION: is there a way to get only the header information from the message enumerator?

Ty.

代码:

browser = session.createBrowser(q);
        @SuppressWarnings("unchecked")
        Enumeration msgs = browser.getEnumeration();
        if (!msgs.hasMoreElements()) {
        } else {
            reading = true;
            while (msgs.hasMoreElements()) {
            Message tempMsg = msgs.nextElement();
            FrontMessage result = new FrontMessage();
            result.setFormat(tempMsg.getStringProperty("JMS_IBM_Format"));
            result.setApplication(tempMsg.getStringProperty("JMSXAppID"));
            result.setDate(tempMsg.getStringProperty("JMS_IBM_PutDate"));
            result.setTime(tempMsg.getStringProperty("JMS_IBM_PutTime"));
            result.setEncoding(tempMsg.getStringProperty("JMS_IBM_Encoding"));
            result.setMessageId(tempMsg.getJMSMessageID());
            result.setCorrelationId(tempMsg.getJMSCorrelationID());
            result.setCharSet(tempMsg.getStringProperty("JMS_IBM_Character_Set"));
            messages.add(result);
            }
        }

推荐答案

使用QueueBrowse时,您浏览的客户端和/或提供程序允许的浏览次数会达到您的浏览次数.没有选项来浏览邮件的各个部分.一条消息是全部还是全部.尽管您可以将主体归零",但最慢的部分很可能是在邮件的检索中.

When you use QueueBrowse you browse as many as the client and or provider allow you to at once. There is no option to browse parts of a message. A message is all or nothing. While you can "zero out" the body, the slow part is most likely in the retrieval of the messages.

基于要查找的标题/属性,我假设您正在使用WebSphere MQ.如果是这样,如果您使用本机WMQ API(Java的WMQ客户端与JMS的WMQ客户端)进行浏览,则可以对浏览进行更多控制,但是您仍然可以浏览完整的消息.

Based off the headers/properties you are looking for, I'm assuming you are using WebSphere MQ. If so, you can gain a little more control over the browsing if you use the native WMQ API (WMQ Client for Java vs WMQ Client for JMS) to browse, but you still browse the full message.

这篇关于JAVA-JMS,浏览大型短信时速度较慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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