aiormq
aiormq copied to clipboard
cause: ValueError('year 55675 is out of range')
Getting this error when consuming from a queue when the message has an epoch timestamp. Is this a bug or is there a workaround?
Please attach the code example, this should be very helpful
Sure, heres the code
import os
import asyncio
import aiormq
import ssl
import logging
logging.basicConfig(level=logging.DEBUG)
ably_queue_name = os.environ['ABLY_QUEUE_NAME']
ably_host_endpoint = os.environ['ABLY_HOST_ENDPOINT']
ably_host_port = 5671
ably_api_key = os.environ["ABLY_API_KEY"]
ably_queue_endpoint = f"amqps://{ably_api_key}@{ably_host_endpoint}/shared"
print(ably_api_key)
async def on_message(message):
print(message.body.timestamp)
async def consumer_messages2():
connection = await aiormq.connect(ably_queue_endpoint)
channel = await connection.channel()
await channel.basic_consume(ably_queue_name,on_message,no_ack=False)
loop = asyncio.get_event_loop()
loop.run_until_complete(consumer_messages2())
loop.run_forever()
And the debug output
DEBUG:asyncio:Using selector: EpollSelector DEBUG:aiormq.connection:Connecting to: amqps://******.******:******@eu-west-1-a-queue.ably.io:5671/shared DEBUG:aiormq.connection:Prepare to send ChannelFrame(payload=b'\x01\x00\x01\x00\x00\x00\x06\x00\x14\x00\n\x010\xce', should_close=False, drain_future=None) DEBUG:aiormq.connection:Received frame <Channel.OpenOk object at 0x7f2ee9353c80> in channel #1 weight=16 on <Connection: "amqps://******.******:******@eu-west-1-a-queue.ably.io:5671/shared" at 0x7f2ee93129d0> DEBUG:aiormq.connection:Prepare to send ChannelFrame(payload=b'\x01\x00\x01\x00\x00\x00\x05\x00U\x00\n\x00\xce', should_close=False, drain_future=None) DEBUG:aiormq.connection:Received frame <Confirm.SelectOk object at 0x7f2ee932ac20> in channel #1 weight=12 on <Connection: "amqps://******.******:******@eu-west-1-a-queue.ably.io:5671/shared" at 0x7f2ee93129d0> DEBUG:aiormq.connection:Prepare to send ChannelFrame(payload=b'\x01\x00\x01\x00\x00\x00D\x00<\x00\x14\x00\x00\x11ATX0YA:mike-queue&ctag1.9a80d364ba954d8789fffe03c032510a\x00\x00\x00\x00\x00\xce', should_close=False, drain_future=None) DEBUG:aiormq.connection:Received frame <Basic.ConsumeOk object at 0x7f2ee93058c0> in channel #1 weight=51 on <Connection: "amqps://******.******:******@eu-west-1-a-queue.ably.io:5671/shared" at 0x7f2ee93129d0> DEBUG:aiormq.connection:Received frame <Basic.Deliver object at 0x7f2ee9384520> in channel #1 weight=79 on <Connection: "amqps://******.******:******@eu-west-1-a-queue.ably.io:5671/shared" at 0x7f2ee93129d0> DEBUG:aiormq.connection:Reader exited for <Connection: "amqps://ATX0YA.AGsQUA:******@eu-west-1-a-queue.ably.io:5671/shared" at 0x7f2ee93129d0> DEBUG:aiormq.connection:Cancelling cause reader exited abnormally DEBUG:aiormq.connection:Sending <Connection.Close object at 0x7f2ee9379490> to <Connection: "amqps://******.******:******@eu-west-1-a-queue.ably.io:5671/shared" at 0x7f2ee93129d0> DEBUG:aiormq.connection:Writer on connection amqps://******.******:******@eu-west-1-a-queue.ably.io:5671/shared closed DEBUG:aiormq.connection:Writer exited for <Connection: "amqps://******.******:******:******@eu-west-1-a-queue.ably.io:5671/shared" at 0x7f2ee93129d0> DEBUG:aiormq.connection:Closing connection <Connection: "amqps://******.******:******:******@eu-west-1-a-queue.ably.io:5671/shared" at 0x7f2ee93129d0> cause: ValueError('year 55675 is out of range')
Could you please add dumped message or another way how can I reproduce it?
A basic message would look like this
id: '0peB9toeCW:0:0', connectionId: '0peB9toeCW', timestamp: 1695029470478, data: 'hello', name: ''