GMO in order to tell MQ to wait for messages for a given time. Get Message Options (GMO), however in this case one needs to specify custom If not told otherwise, Queue.get builds up a default Message Descriptor (MD) and.Queue ( qmgr, queue_name ) message = queue. connect ( queue_manager, channel, conn_info ) queue = pymqi. WaitInterval = 5000 # 5 seconds qmgr = pymqi. Import pymqi queue_manager = 'QM1' channel = '' host = '127.0.0.1' port = '1414' queue_name = 'TEST.1' conn_info = ' %s ( %s )' % ( host, port ) # Message Descriptor md = pymqi. How to get a message without JMS (MQRFH2) headers Also, that encoding's corresponding CCSID - 819 - is given on input In the example below, message is a Unicode object and it will be converted to ISO-8859-1 by PyMQIīecause this is the encoding explicitly specified.Only if Unicode objects are given on input to queue.put - if data is already bytes, there is no conversion. Again, the conversion from Unicode to bytes as well as the application of bytes_encoding and default_ccsid take place.It is also the user's responsibility to ensure that default_ccsid matches the queue manager's CCSID.If not using the defaults, it is the user's responsibility to make sure that the two parameters match - for instance,Įncoding UTF-8 is represented by CCSID 1208, but a different CCSID may be required with other encodings.On the level of the connection to a queue manager, rather than individually for each put call. Both parameters will be used in all put calls related to a single MQ connection - that is, they are specified once only.Parameter default_ccsid is used to specify a CCSID in the underlying call's MQMD structure.Parameter bytes_encoding is used for conversion of Python Unicode objects to bytes objects.The parameters are called bytes_encoding and default_ccsid and their default values are utf,.Two parameters when calling nnect or when constructing QueueManager objects. It is possible to change the default encoding used for conversion from Unicode to bytes by providing.Using UTF-8 by default - this should suffice in most cases. If you give queue.put Unicode objects on input, though, they will be automatically converted to bytes,.Your data as bytes before handling it to queue.put, the data will be sent as-is. PyMQI does not process in any way bytes objects used in queue.put calls - this means that if you encode.Unicode and bytes handling is unified in PyMQI regardless of whether one uses Python 2 or 3, i.e.Įverything above applies to both Python lines.connect ( queue_manager, channel, conn_info, bytes_encoding = bytes_encoding, default_ccsid = default_ccsid ) queue = pymqi. Import pymqi queue_manager = 'QM1' channel = '' host = '127.0.0.1' port = '1414' queue_name = 'TEST.1' message = u 'My Unicode data' conn_info = ' %s ( %s )' % ( host, port ) bytes_encoding = 'iso-8859-1' default_ccsid = 819 qmgr = pymqi.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |