Oracle AdvancedQueuing: failing to broadcast (ORA-24033: no recipients for message, Python client)

465 Views Asked by At

I am referring to the following project on GitHub: poc-oracle-aq

The code responsible for publishing messages is located in scripts/publisher.py:

def loop(connection, queue_high, queue_low, name):
    recipients = ['Subscriber01', 'Subscriber02', 'Subscriber03']
    while True:
        pause = random.randint(10, 30)
        sleep(float(pause) / 10.)
        value = random.randint(1, 100)
        message = {'timestamp': datetime.now(), 'source': name, 'value': value}
        if value < 10:
            logging.info('sending {}'.format(message))
            queue_low.enqone(connection.msgproperties(payload=json.dumps(message, cls=DateTimeEncoder), recipients=recipients))
        elif value > 90:
            logging.info('sending {}'.format(message))
            queue_high.enqone(connection.msgproperties(payload=json.dumps(message, cls=DateTimeEncoder), recipients=recipients))

        connection.commit()

This is working well for multicast, where subscribers are listed as recipients and provided as a message parameter when calling the enqone() method.

However according to the documentation I should be able to perform the same call without specifying the recipients in order to broadcast the message to all subscribers.

When setting the recipients to None in the first line of the loop() function above:

recipients = None

I get the following error when I try:

  File "src/oracledb/impl/thick/queue.pyx", line 117, in oracledb.thick_impl.ThickQueueImpl.enq_one
  File "src/oracledb/impl/thick/utils.pyx", line 410, in oracledb.thick_impl._raise_from_odpi
  File "src/oracledb/impl/thick/utils.pyx", line 400, in oracledb.thick_impl._raise_from_info
oracledb.exceptions.DatabaseError: ORA-24033: no recipients for message

According to the documentation that means:

Error code: ORA-24033 Description: no recipients for message Cause: An enqueue was performed on a queue that has been set up for multiple dequeuers but there were neither explicit recipients specified in the call nor were any queue subscribers determined to be recipients for this message. Action: Either pass a list of recipients in the enqueue call or add subscribers to the queue for receiving this message.

However I do have subscribers running and listening when the publisher is sending the message. Is there an undocumented parameter when calling enqone()?

I am using Oracle Thick Client 19.8 and Oracle Enterprise 19.3.

0

There are 0 best solutions below