rename message

This commit is contained in:
anlicheng 2025-09-22 17:43:56 +08:00
parent 7d2cd8738f
commit aaf92cb57d
3 changed files with 4 additions and 4 deletions

View File

@ -85,7 +85,7 @@
params :: binary() params :: binary()
}). }).
-record(event_stream, { -record(task_event_stream, {
task_id :: integer(), task_id :: integer(),
stream :: binary() stream :: binary()
}). }).

View File

@ -125,7 +125,7 @@ handle_event(cast, {event, ServiceId, EventType, Params}, _, State) ->
{keep_state, State}; {keep_state, State};
handle_event(cast, {task_event_stream, TaskId, Stream}, ?STATE_ACTIVATED, State = #state{transport_pid = TransportPid}) -> handle_event(cast, {task_event_stream, TaskId, Stream}, ?STATE_ACTIVATED, State = #state{transport_pid = TransportPid}) ->
EventPacket = message_codec:encode(?MESSAGE_EVENT_STREAM, #event_stream{ EventPacket = message_codec:encode(?MESSAGE_EVENT_STREAM, #task_event_stream{
task_id = TaskId, task_id = TaskId,
stream = Stream stream = Stream
}), }),

View File

@ -67,7 +67,7 @@ encode0(#event{service_id = ServiceId, event_type = EventType, params = Params})
marshal(?I32, EventType), marshal(?I32, EventType),
marshal(?Bytes, Params) marshal(?Bytes, Params)
]); ]);
encode0(#event_stream{task_id = TaskId, stream = Stream}) -> encode0(#task_event_stream{task_id = TaskId, stream = Stream}) ->
iolist_to_binary([ iolist_to_binary([
marshal(?Bytes, TaskId), marshal(?Bytes, TaskId),
marshal(?I32, Stream) marshal(?I32, Stream)
@ -98,7 +98,7 @@ decode0(?MESSAGE_DATA, [ServiceId, DeviceUUID, RouteKey, Metric]) ->
decode0(?MESSAGE_EVENT, [ServiceId, EventType, Params]) -> decode0(?MESSAGE_EVENT, [ServiceId, EventType, Params]) ->
{ok, #event{service_id = ServiceId, event_type = EventType, params = Params}}; {ok, #event{service_id = ServiceId, event_type = EventType, params = Params}};
decode0(?MESSAGE_EVENT_STREAM, [TaskId, Stream]) -> decode0(?MESSAGE_EVENT_STREAM, [TaskId, Stream]) ->
{ok, #event_stream{task_id = TaskId, stream = Stream}}; {ok, #task_event_stream{task_id = TaskId, stream = Stream}};
decode0(_, _) -> decode0(_, _) ->
error. error.