Rpc breakages - request_log_pb2

Hey guys,

i was using the redis stream from “api:stream:request” to do some simple updates to helium devices when a request hit the redis stream decoding via the following rpc key api.request_log_pb2.RequestLog().

however it seems in the latest 4.6 update request_log_pb2 has been depreciated and I cannot seem to find any other stream this is available in from my hunt over the last few hours to fix this so far.

if anyone knows can you let me know if it has been moved please let me know. i will keep looking the DeviceSession does not seem feasible as i need to pass in data to use it which you do not have.

Ok i think i’ve managed to find the new location after a look around on the chirpstack site phew… so for future me :smiley:

and a minimum working python example in case anyone else gets stuck.

import asyncio
import redis.asyncio as redis
from google.protobuf.json_format import MessageToJson
from chirpstack_api import stream


pool = redis.ConnectionPool(host='chirpstack-redis', port=6379, db=0)
rdb = redis.Redis(connection_pool=pool, decode_responses=True)


async def stream_api_requests():
    stream_key = "api:stream:request"
    last_id = '0'
    while True:
        try:
            resp = await rdb.xread({stream_key: last_id}, count=1, block=0)
            for message in resp[0][1]:
                last_id = message[0]
                print('========== v RAW REQUEST MESSAGE v ==========')
                print(message[1])
                print('========== ^ RAW REQUEST MESSAGE ^ ==========')

                if b'request' in message[1]:
                    msg = message[1][b'request']
                    # print(msg)
                    print('========== v REQUEST MESSAGE v ==========')
                    pl = stream.api_request_pb2.ApiRequestLog()
                    pl.ParseFromString(msg)
                    print(MessageToJson(pl))
                    print('========== ^ REQUEST MESSAGE ^ ==========')
        except Exception as err:
            print('Error:', err)

asyncio.run(stream_api_requests())

Yes, see the v4.6 release notes with the refactoring into the streams package: