Closed auarbekov closed 1 year ago
Issue #, if available: add callback for disconnect
Description of changes:
Why is this change necessary: Implement callback
How was this change tested: Start a local broker and disconnect while the client is running.
Test results:
[INFO ] 2023-07-17 13:45:48.427 [grpc-default-executor-0] GRPCDiscoveryServer - RegisterAgent: agentId client1 [INFO ] 2023-07-17 13:45:48.514 [grpc-default-executor-0] GRPCDiscoveryServer - DiscoveryClient: agentId client1 address 127.0.0.1 port 42735 [INFO ] 2023-07-17 13:45:48.516 [grpc-default-executor-0] EngineControlImpl - Created new agent control for client1 on 127.0.0.1:42735 [INFO ] 2023-07-17 13:45:48.541 [grpc-default-executor-0] ExampleControl - Agent client1 is connected [INFO ] 2023-07-17 13:45:48.543 [pool-2-thread-1] AgentTestScenario - Playing test scenario for agent id client1 [INFO ] 2023-07-17 13:45:51.551 [pool-2-thread-1] AgentTestScenario - Set CONNECT user property: region, US [INFO ] 2023-07-17 13:45:51.551 [pool-2-thread-1] AgentTestScenario - Set CONNECT user property: type, JSON [INFO ] 2023-07-17 13:45:51.552 [pool-2-thread-1] AgentTestScenario - Set CONNECT request response information true [INFO ] 2023-07-17 13:45:52.024 [pool-2-thread-1] AgentControlImpl - Created connection with id 1 CONNACK 'sessionPresent: false receiveMaximum: 20 retainAvailable: true ' [INFO ] 2023-07-17 13:45:52.024 [pool-2-thread-1] AgentControlImpl - createMqttConnection: MQTT connectionId 1 created [INFO ] 2023-07-17 13:45:52.024 [pool-2-thread-1] AgentTestScenario - MQTT connection with id 1 is established [INFO ] 2023-07-17 13:45:57.028 [pool-2-thread-1] AgentTestScenario - Set SUBSCRIBE user property: region, US [INFO ] 2023-07-17 13:45:57.028 [pool-2-thread-1] AgentTestScenario - Set SUBSCRIBE user property: type, JSON [INFO ] 2023-07-17 13:45:57.032 [pool-2-thread-1] AgentControlImpl - SubscribeMqtt: subscribe on connection 1 [INFO ] 2023-07-17 13:45:57.048 [pool-2-thread-1] AgentTestScenario - Subscribe response: connectionId 1 reason codes [0] reason string '' [INFO ] 2023-07-17 13:46:01.673 [grpc-default-executor-0] GRPCDiscoveryServer - OnMqttDisconnect: agentId client1 connectionId 1 disconnect 'reasonCode: 0 ' error 'Connection lost' [INFO ] 2023-07-17 13:46:01.673 [grpc-default-executor-0] AgentTestScenario - MQTT disconnected on agentId client1 connectionId 1 disconnect 'reasonCode: 0 ' error 'Connection lost' [INFO ] 2023-07-17 13:46:07.052 [pool-2-thread-1] AgentTestScenario - Set PUBLISH payload format indicator true [INFO ] 2023-07-17 13:46:07.052 [pool-2-thread-1] AgentTestScenario - Set PUBLISH message expiry interval 3600 [INFO ] 2023-07-17 13:46:07.052 [pool-2-thread-1] AgentTestScenario - Set PUBLISH response topic /thing1/response/topic [INFO ] 2023-07-17 13:46:07.053 [pool-2-thread-1] AgentTestScenario - Set PUBLISH correlation data <ByteString@61f9c11e size=16 contents="correlation_data"> [INFO ] 2023-07-17 13:46:07.053 [pool-2-thread-1] AgentTestScenario - Set PUBLISH user property: region, US [INFO ] 2023-07-17 13:46:07.053 [pool-2-thread-1] AgentTestScenario - Set PUBLISH user property: type, JSON [INFO ] 2023-07-17 13:46:07.053 [pool-2-thread-1] AgentTestScenario - Set PUBLISH content type text/plain; charset=utf-8 [INFO ] 2023-07-17 13:46:07.056 [pool-2-thread-1] AgentControlImpl - PublishMqtt: publishing on connectionId 1 topic test/topic [INFO ] 2023-07-17 13:46:07.079 [pool-2-thread-1] AgentTestScenario - Published connectionId 1 reason code 32104 reason string 'Client is not connected' [INFO ] 2023-07-17 13:46:12.080 [pool-2-thread-1] AgentTestScenario - Set UNSUBSCRIBE user property: region, US [INFO ] 2023-07-17 13:46:12.080 [pool-2-thread-1] AgentTestScenario - Set UNSUBSCRIBE user property: type, JSON [INFO ] 2023-07-17 13:46:12.085 [pool-2-thread-1] AgentControlImpl - UnsubscribeMqtt: unsubscribe on connectionId 1 [INFO ] 2023-07-17 13:46:12.097 [pool-2-thread-1] AgentTestScenario - Unsubscribe response: connectionId 1 reason codes [32104] reason string 'Client is not connected' [INFO ] 2023-07-17 13:46:22.098 [pool-2-thread-1] AgentTestScenario - Set DISCONNECT user property: region, US [INFO ] 2023-07-17 13:46:22.098 [pool-2-thread-1] AgentTestScenario - Set DISCONNECT user property: type, JSON [INFO ] 2023-07-17 13:46:52.217 [pool-2-thread-1] AgentControlImpl - closeMqttConnection: MQTT connectionId 1 closed [INFO ] 2023-07-17 13:46:52.220 [pool-2-thread-1] AgentControlImpl - sending shutdown request [INFO ] 2023-07-17 13:46:52.234 [pool-2-thread-1] AgentControlImpl - shutdown request sent successfully [INFO ] 2023-07-17 13:46:52.290 [grpc-default-executor-0] GRPCDiscoveryServer - UnregisterAgent: agentId client1 reason Agent shutdown by OTF request 'That's it.' [INFO ] 2023-07-17 13:46:52.291 [grpc-default-executor-0] AgentControlImpl - shutting down channel with agent id client1 [INFO ] 2023-07-17 13:46:52.292 [grpc-default-executor-0] AgentControlImpl - channel terminated with agent id client1 [INFO ] 2023-07-17 13:46:52.292 [grpc-default-executor-0] ExampleControl - Agent client1 is disconnected
Any additional information or context required to review the change:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Issue #, if available: add callback for disconnect
Description of changes:
Why is this change necessary: Implement callback
How was this change tested: Start a local broker and disconnect while the client is running.
Test results:
Any additional information or context required to review the change:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.