I have a question about stream queue

20 views
Skip to first unread message

이가람

unread,
Jul 3, 2024, 9:41:09 PM7/3/24
to Pika
# Streaming
channel.queue_declare(queue=receive_queue, durable=True,
arguments={'x-max-age': '7D',
'x-queue-type': 'stream'})

# Classic
channel.queue_declare(queue=send_queue, durable=True)


# Read images from the local directory
image_directory = './DATA/3-25-1920x1080'
images = read_images_from_directory(image_directory)

batch_size = 10

for batch in batch_images(images, batch_size):
frames = np.stack(batch, axis=0) # Stack images to create a batch

FaceEmoRecogRQ = create_message(org_id=org_id,
user_id=user_id,
receive_queue=receive_queue,
send_queue=send_queue,
data=frames)

# Define the ErkEngineCreateRQ message to send
serialized = FaceEmoRecogRQ.SerializeToString()

channel.basic_publish(exchange='', routing_key=receive_queue,
properties=pika.BasicProperties(reply_to=send_queue), body=serialized)

.
.
.



I'm wondering if that source code is using the stream queue correctly.

I've declared a stream queue, but is it okay to use it using basic_publish?
Reply all
Reply to author
Forward
0 new messages