Open
Description
{"signal_id":2801684810234,"type":"SIGNAL","signaltype":"NEW_ENTRY","exit_time":datetime.time(15,55),"remarks":26}
elif isinstance(obj, datetime.time):
# always encode in the 8-byte form
data = datetime.datetime.combine(
datetime.datetime.today(), obj)
data = int((obj.hour * 60 * 60 + obj.minute * 60 + obj.second) * 1e6
+ obj.microsecond)
return KanhojiExtType(1, data.to_bytes(8, byteorder='big'))
this is my encoding logic
I am sending this from python. datetime format which in convert in "int" with type code 1
when i deserialise msgpack in cpp
{"signal_id":2801684810234,"type":"SIGNAL","signaltype":"NEW_ENTRY","exit_time":"EXT(type:1,size:8)","remarks":26}
could you help me to deserialising this field "exit_time":"EXT(type:1,size:8)" ?
Activity
redboltz commentedon May 25, 2023
When msgpack-c(C++) receives EXT format family MessagePack formatted byte stream, msgpack-c creates
msgpack::object
and its type ismsgpack::type::EXT
.See https://github.com/msgpack/msgpack-c/wiki/v2_0_cpp_object
You can access
msgpack::object
directly as follows:msgpack-c/test/msgpack_basic.cpp
Line 328 in ac062e2
Or you can use
msgpack::type::ext
ormsgpack::type::ext_ref
helper classes as follows:msgpack-c/test/msgpack_basic.cpp
Lines 590 to 608 in ac062e2
Avalanchecoder commentedon May 25, 2023
redboltz commentedon May 25, 2023
I recommend that create a simple code (no MAP, no AMQP).
That is focused on msgpack EXT only like the test code I mentioned.
And confirm the simple code works well, and then apply your project.