diff --git a/clients/command.go b/clients/command.go index 7a9c42e5..e658867e 100644 --- a/clients/command.go +++ b/clients/command.go @@ -25,7 +25,7 @@ import ( ) const ( - QueryRequestTopic = "QueryRequestTopic" + QueryRequestTopicPrefix = "QueryRequestTopicPrefix" QueryResponseTopic = "QueryResponseTopic" CommandRequestTopicPrefix = "CommandRequestTopicPrefix" CommandResponseTopic = "CommandResponseTopic" @@ -96,7 +96,7 @@ func (c *CommandClient) AllDeviceCoreCommands(ctx context.Context, offset int, l queryParams := map[string]string{common.Offset: strconv.Itoa(offset), common.Limit: strconv.Itoa(limit)} requestEnvelope := types.NewMessageEnvelopeForRequest(nil, queryParams) - requestTopic := strings.Join([]string{c.topics[QueryRequestTopic], common.All}, "/") + requestTopic := strings.Join([]string{c.topics[QueryRequestTopicPrefix], common.All}, "/") err := c.messageBus.Publish(requestEnvelope, requestTopic) if err != nil { return responses.MultiDeviceCoreCommandsResponse{}, edgexErr.NewCommonEdgeXWrapper(err) @@ -135,7 +135,7 @@ func (c *CommandClient) DeviceCoreCommandsByDeviceName(ctx context.Context, devi } requestEnvelope := types.NewMessageEnvelopeForRequest(nil, nil) - requestTopic := strings.Join([]string{c.topics[QueryRequestTopic], deviceName}, "/") + requestTopic := strings.Join([]string{c.topics[QueryRequestTopicPrefix], deviceName}, "/") err := c.messageBus.Publish(requestEnvelope, requestTopic) if err != nil { return responses.DeviceCoreCommandResponse{}, edgexErr.NewCommonEdgeXWrapper(err) diff --git a/clients/command_test.go b/clients/command_test.go index 5cc9c263..ecb6e6eb 100644 --- a/clients/command_test.go +++ b/clients/command_test.go @@ -63,8 +63,8 @@ func (m mockMessageClient) Disconnect() error { func TestCommandClient_AllDeviceCoreCommands(t *testing.T) { mockMessageBus := mockMessageClient{signal: make(chan struct{})} topics := map[string]string{ - QueryRequestTopic: testQueryRequestTopic, - QueryResponseTopic: testQueryResponseTopic, + QueryRequestTopicPrefix: testQueryRequestTopic, + QueryResponseTopic: testQueryResponseTopic, } client, err := NewCommandClient(mockMessageBus, topics, 10*time.Second) @@ -100,8 +100,8 @@ func TestCommandClient_AllDeviceCoreCommands(t *testing.T) { func TestCommandClient_DeviceCoreCommandsByDeviceName(t *testing.T) { mockMessageBus := mockMessageClient{signal: make(chan struct{})} topics := map[string]string{ - QueryRequestTopic: testQueryRequestTopic, - QueryResponseTopic: testQueryResponseTopic, + QueryRequestTopicPrefix: testQueryRequestTopic, + QueryResponseTopic: testQueryResponseTopic, } client, err := NewCommandClient(mockMessageBus, topics, 10*time.Second)