Im trying to use python azure service bus client to constantly check a queue for new messages that contains process Id. For some reason, everytime i initialize the azure service bus client it runs for a couple of seconds then output the following message: Process finished with exit code -1073741819 (0xC0000005)
. Ive double checked my queue names and everything but I cannot understand what the issue is.
with servicebus_client:
    receiver = servicebus_client.get_queue_receiver( queue_name=CALC_REQUEST_QUEUE)
    print( "state 1" )
    with receiver:
        print("state")
        for msg in receiver:
            calc_request = json.loads( str( msg ) )
            processing_identifier = calc_request.get( 'processingIdentifier', None )
            print( "Received: " + str( processing_identifier ) )
            calc_config = fetch_calc_configuration( processing_identifier )
            calc_response = invoke_capsule_summary_processing(calc_config)
 lmomoh
 lmomohIf you just want to pull new messages from some queue continuously,try This :
import asyncio
from asyncio.tasks import sleep
from azure.servicebus.aio import ServiceBusClient
CONNECTION_STR = ''
QUEUE_NAME = ''
async def main():
    servicebus_client = ServiceBusClient.from_connection_string(conn_str=CONNECTION_STR)
    async with servicebus_client:
        receiver = servicebus_client.get_queue_receiver(queue_name=QUEUE_NAME)
        async with receiver:
            received_msgs = await receiver.receive_messages(max_message_count=10, max_wait_time=5)
            for msg in received_msgs:
                print(str(msg))
                await receiver.complete_message(msg)
loop = asyncio.get_event_loop()
while True : 
    #each 10 seconds to pull messages from queue.
    sleep(10)  
    print('pull messages...')
    loop.run_until_complete(main())
User contributions licensed under CC BY-SA 3.0