Closed rlenka1 closed 2 years ago
Version 1.0 was returning MSGID but new version 1.1 not returning
Tried with PLSQL it is also returning
Can you provide a complete script that demonstrates the problem? And include the PL/SQL script as well? I'm not sure which attribute you are referring to. Thanks!
/ This is part of 15. Using Oracle Advanced Queuing (AQ), when we enqueue. If we run below in PLSQL we get the MSGID, same was also happening in the python when we had below in python a=queue.enqone(con.msgproperties(payload=book)) print(a)/
set serveroutput on;
DECLARE
enqueue_options DBMS_AQ.enqueue_options_t;
message_properties DBMS_AQ.message_properties_t;
message_handle RAW(16);
message message_typ;
BEGIN
FOR groupno in 1..3 LOOP
FOR msgno in 1..3 LOOP
message := message_typ(
004,
'GROUP ' || groupno,
'Message ' || msgno || ' in group ' || groupno);
DBMS_AQ.ENQUEUE(
queue_name => 'group_queue',
enqueue_options => enqueue_options,
message_properties => message_properties,
payload => message,
msgid => message_handle);
DBMS_OUTPUT.PUT_LINE(message_handle);
END LOOP;
COMMIT;
END LOOP;
END;
/
***Python code**
con = oracledb.connect(user=p_username, password=p_password, dsn="teqodb_medium",
config_dir="C:\\Users\\User\\Documents\\OracleAutonomousDB\\teqodb\\teqodb_extract",
wallet_location="C:\\Users\\User\\Documents\\OracleAutonomousDB\\teqodb\\teqodb_extract",
wallet_password=p_walletpass)
# In[34]:
print(con)
# In[35]:
book_type = con.gettype("MESSAGE_TYPE")
# In[36]:
queue = con.queue("OBJTYPE_TEQ5", book_type)
# In[37]:
queue.enqoptions.visibility = oracledb.ENQ_IMMEDIATE
# In[38]:
book = book_type.newobject()
# In[39]:
book.SUBJECT = "Hi There1"
# In[40]:
book.TEXT = "I am Python"
# In[44]:
a = queue.enqone(con.msgproperties(payload=book))
# In[42]:
print(a)
*** now the print just gives "None" , earlier it was returning MSGIDg
Hmm, I don't see any changes between 1.0 and 1.1 that would suggest print(a)
would have produced anything except None
. I tried with version 1.0 and confirmed that was indeed the case. You can manipulate the object_aq.py
sample like I did to verify that fact. Looks to me like you want to do this, though:
msg = con.msgproperties(payload=book)
queue.enqone(msg)
print("msgid:", msg.msgid)
Thanks.
The output now i get from python is
msgid: b'\xe9\x1eo@mQn\xfc\xe0S#\x14\x00\nSi' msgid: b'\xe9\x1eo@mSn\xfc\xe0S#\x14\x00\nSi' msgid: b'\xe9\x1eo@mUn\xfc\xe0S#\x14\x00\nSi' msgid: b'\xe9\x1eo@mWn\xfc\xe0S#\x14\x00\nSi' msgid: b'\xe9\x1eo@mYn\xfc\xe0S#\x14\x00\nSi' msgid: b'\xe9\x1eo@m[n\xfc\xe0S#\x14\x00\nSi'
But in DB via PLSQL i get E91E6F406D526EFCE0532314000A5369 E91E6F406D536EFCE0532314000A5369 E91E6F406D546EFCE0532314000A5369 E91E6F406D556EFCE0532314000A5369 E91E6F406D566EFCE0532314000A5369 E91E6F406D576EFCE0532314000A5369
Something needs to do with conversion maybe if you can help
Those look to be the same. You can confirm that by using this code:
msg = con.msgproperties(payload=book)
queue.enqone(msg)
print("msgid:", msg.msgid.hex().upper())
Yes, perfect, thanks for your help, i can reconcile easily now
Is it an error or a hang or a crash?
What error(s) or behavior you are seeing?
a=queue.enqone(con.msgproperties(payload=book)) print(a)