rename message
This commit is contained in:
parent
7d2cd8738f
commit
aaf92cb57d
@ -85,7 +85,7 @@
|
||||
params :: binary()
|
||||
}).
|
||||
|
||||
-record(event_stream, {
|
||||
-record(task_event_stream, {
|
||||
task_id :: integer(),
|
||||
stream :: binary()
|
||||
}).
|
||||
@ -125,7 +125,7 @@ handle_event(cast, {event, ServiceId, EventType, Params}, _, State) ->
|
||||
{keep_state, State};
|
||||
|
||||
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,
|
||||
stream = Stream
|
||||
}),
|
||||
|
||||
@ -67,7 +67,7 @@ encode0(#event{service_id = ServiceId, event_type = EventType, params = Params})
|
||||
marshal(?I32, EventType),
|
||||
marshal(?Bytes, Params)
|
||||
]);
|
||||
encode0(#event_stream{task_id = TaskId, stream = Stream}) ->
|
||||
encode0(#task_event_stream{task_id = TaskId, stream = Stream}) ->
|
||||
iolist_to_binary([
|
||||
marshal(?Bytes, TaskId),
|
||||
marshal(?I32, Stream)
|
||||
@ -98,7 +98,7 @@ decode0(?MESSAGE_DATA, [ServiceId, DeviceUUID, RouteKey, Metric]) ->
|
||||
decode0(?MESSAGE_EVENT, [ServiceId, EventType, Params]) ->
|
||||
{ok, #event{service_id = ServiceId, event_type = EventType, params = Params}};
|
||||
decode0(?MESSAGE_EVENT_STREAM, [TaskId, Stream]) ->
|
||||
{ok, #event_stream{task_id = TaskId, stream = Stream}};
|
||||
{ok, #task_event_stream{task_id = TaskId, stream = Stream}};
|
||||
decode0(_, _) ->
|
||||
error.
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user