English 中文(简体)
在MSMQ电文中显示脱硫的外壳
原标题:Extra Characthers showing up after peeking at an MSMQ message
  • 时间:2012-04-20 15:49:20
  •  标签:
  • python
  • msmq

我正在更新使用Biztalk、MSMQs、Java和Python的旧遗产系统。

目前,我正试图提升一个特定项目,该项目一旦完成,将让我开始取代许多遗留系统。

我迄今所做的工作是,在比什特克新版(2010年)上,以及在最后一段时期的机器上,重新恢复遗留系统。

不管怎么说,我面临的问题是,存在着一部灰色的法,从一个MSMQ那里收集了信息,将其放在另一个服务器上。 自2004年以来,这项法典已经在我国遗产制度上实施,并自那时起一直发挥作用。 我知道,从来没有改变过。

现在,在我重建时,我开始在遥远的服务器中发现错误,在检查了几件事情并排除了许多可能的问题之后,我已经确定,这一错误发生在从MSMQ接手的Sharma编码的前后。

错误只能用两条电文产生。 请注意,我在此使用XMls样本,因为实际数字相当长。

信息一:

<xml>
  <field1>Text 1</field1>
  <field2>Text 2</field2>
</xml>

通告二:

<xml>
  <field1>Text 1</field1>
</xml>

现在,如果我向MSMQ发出电文后发出电文2,那么在座标上就正确了。 如果我打电话给Sharma,则电文正确回来,但电文中有两个好处。

邮政电文2:

<xml>
  <field1>Text 1</field1>
</xml>1>Te

我首先认为,在沙捞越法中可能存在问题,但我已经走过这个问题,而且我也找不到。 然而,我必须承认,我第一次认真研究沙尔法。

灰尘器首先用电文接收。 我在字母缩略语时看到了这一信息,而且其错误信息与收到时一样。

而且,这一错误只有在从更长的信息传递到短信息时才显示出来。

我欢迎任何可能错过的东西的建议,或我可以做些什么来确定问题。

我 go和搜身,走了一点.。 这是整个项目的延续,因为我们可以开始用这个已建的系统取代旧系统,作为新的桥梁。

感谢用时间阅读我的问题。

Edit: Here s the relevant Python code:

import sys

import pythoncom
from win32com.client import gencache
msmq = gencache.EnsureModule( {D7D6E071-DCCD-11D0-AA4B-0060970DEBAE} , 0, 1, 0)

def Peek(queue):
qi = msmq.MSMQQueueInfo()
qi.PathName = queue

myq = qi.Open(msmq.constants.MQ_PEEK_ACCESS,0)
if myq.IsOpen:
    # Don t loose this pythoncom.Empty thing (it took a while)
    tmp = myq.Peek(pythoncom.Empty, pythoncom.Empty, 1)
myq.Close()     
return tmp

The function calls this piece of code. I don t have access to the code that calls this until Monday, but the call is basically:

msg= MSMQ.peek()

2nd Edit.

I am attaching the first half of the script. this basically loops around

import base64, xmlrpclib, time
import MSMQ, Config, Logger
import XmlRpcExt,os,whrandom

QueueDetails = Config.InQueueDetails
sleeptime = Config.SleepTime
XMLRPCServer = Config.XMLRPCServer
usingBase64 = Config.base64ing
version=Config.version
verbose=Config.verbose

LogO = Logger.Logger()

def MSMQToIAMS():
    # moved svr cons out of daemon loop
    LogO.LogP(version)
svr = xmlrpclib.Server(XMLRPCServer, XmlRpcExt.getXmlRpcTransport())
while 1:
        GotOne = 0
        for qd in QueueDetails:
                queue, agency, messagetype = qd
                #LogO.LogD( [ +version+"] Searching queue %s for messages"%queue)

                try:
                        msg=MSMQ.Peek(queue)
                except Exception,e:
                        LogO.LogE("Peeking at "%s" : %s"%(queue, e))
                        continue

                if msg:
                        try:
                          msg = msg.__call__().encode( utf-8 )
                        except:
                          LogO.LogE("Could not convert massege on "%s" to a string, leaving it on queue"%queue)
                          continue
                          
                        if verbose:
                          print "++++++++++++++++++++++++++++++++++++++++"
                          print msg
                          print "++++++++++++++++++++++++++++++++++++++++"
                        LogO.LogP("Found Message on "%s" : "%s...""%(queue, msg[:40]))
                        try:
                                
                                rv = svr.accept(msg, agency, messagetype)
                                if rv[0] != "OK":
                                        raise Exception, rv[0]
                                LogO.LogP( Message has been sent successfully to IAMS from %s %queue)
                                MSMQ.Receive(queue)
                                GotOne = 1
                                StoreMsg(msg)
                        except Exception, e:
                                LogO.LogE("%s"%e)
                
        if GotOne == 0:
                time.sleep(sleeptime)
        else:
                gotOne = 0

This is the full code that calls MSMQ. Creates a little program that watches MSMQ and when a message arrives picks it up and sends it off to another server.

问题回答

声音确实是甲型六氯环己烷(我不知道什么)。 难道这只是一个记忆变数两度使用而不在两者之间清除的情况吗? 第二个电文短于第一个电文,因为第一个电文不透。 粉碎法的相关部分如何看待?

[[21st April]] The code just shows you are populating the tmp variable with a message. What happens to tmp before the next message is accessed? I m assuming it is not cleared.





相关问题
Can Django models use MySQL functions?

Is there a way to force Django models to pass a field to a MySQL function every time the model data is read or loaded? To clarify what I mean in SQL, I want the Django model to produce something like ...

An enterprise scheduler for python (like quartz)

I am looking for an enterprise tasks scheduler for python, like quartz is for Java. Requirements: Persistent: if the process restarts or the machine restarts, then all the jobs must stay there and ...

How to remove unique, then duplicate dictionaries in a list?

Given the following list that contains some duplicate and some unique dictionaries, what is the best method to remove unique dictionaries first, then reduce the duplicate dictionaries to single ...

What is suggested seed value to use with random.seed()?

Simple enough question: I m using python random module to generate random integers. I want to know what is the suggested value to use with the random.seed() function? Currently I am letting this ...

How can I make the PyDev editor selectively ignore errors?

I m using PyDev under Eclipse to write some Jython code. I ve got numerous instances where I need to do something like this: import com.work.project.component.client.Interface.ISubInterface as ...

How do I profile `paster serve` s startup time?

Python s paster serve app.ini is taking longer than I would like to be ready for the first request. I know how to profile requests with middleware, but how do I profile the initialization time? I ...

Pragmatically adding give-aways/freebies to an online store

Our business currently has an online store and recently we ve been offering free specials to our customers. Right now, we simply display the special and give the buyer a notice stating we will add the ...

Converting Dictionary to List? [duplicate]

I m trying to convert a Python dictionary into a Python list, in order to perform some calculations. #My dictionary dict = {} dict[ Capital ]="London" dict[ Food ]="Fish&Chips" dict[ 2012 ]="...

热门标签