Skip to content

Commit 7ab8194

Browse files
committed
feat: Device functions ADR
Align with north-south messaging ADR (#23) Signed-off-by: Iain Anderson <[email protected]>
1 parent 0d6d03b commit 7ab8194

File tree

1 file changed

+42
-16
lines changed

1 file changed

+42
-16
lines changed

docs_src/design/adr/device-service/0021-invoking-functions.md

+42-16
Original file line numberDiff line numberDiff line change
@@ -62,37 +62,51 @@ Note: the `attributes` structure is analagous to `attributes` in a `deviceResour
6262

6363
**Define MessageBus topics on which function call requests and replies are to be made**
6464

65-
`edgex/function-calls/device/[profile-name]/[device-name]/[function-name]`
65+
`edgex/request/function/[device-service-name]/[device-name]`
6666

6767
The payload for messages on these topics should be of the form
6868
```
6969
{
70-
requestId: "184b894f-a7b7-4d6c-b400-99961d462419",
71-
parameters: { (a map of parameter values keyed by parameter name) }
70+
"correlation-id": "1dbbd344-c9f6-4714-8c89-91c1d5b11a90",
71+
"deviceName": "device1",
72+
"function": "functionname",
73+
"request":
74+
{
75+
"requestId": "184b894f-a7b7-4d6c-b400-99961d462419",
76+
"parameter1": "37",
77+
"parameter2": "0"
78+
}
7279
}
73-
```
7480
75-
The `requestId` may be any string but UUIDs are recommended.
81+
```
7682

77-
`edgex/function-responses/device/[profile-name]/[device-name]/[function-name]`
83+
`edgex/response/function/[device-service-name]/[device-name]`
7884

7985
The device service will provide responses to function calls on this topic. The payload will be
8086

8187
```
8288
{
83-
requestId: "184b894f-a7b7-4d6c-b400-99961d462419",
84-
status: 0,
85-
returnValues: { (a map of return values keyed by value name) }
89+
"correlation-id": "1dbbd344-c9f6-4714-8c89-91c1d5b11a90",
90+
"response":
91+
{
92+
"requestId": "184b894f-a7b7-4d6c-b400-99961d462419",
93+
"statusCode": 0,
94+
"returnVal1": "true"
95+
}
8696
}
8797
```
8898

8999
or if a call fails
90100

91101
```
92102
{
93-
requestId: "184b894f-a7b7-4d6c-b400-99961d462419",
94-
status: (nonzero),
95-
errorMessage "Message indicating the nature of the failure"
103+
"correlation-id": "1dbbd344-c9f6-4714-8c89-91c1d5b11a90",
104+
"response":
105+
{
106+
"requestId": "184b894f-a7b7-4d6c-b400-99961d462419",
107+
"statusCode": (nonzero),
108+
"message": "Message indicating the nature of the failure"
109+
}
96110
}
97111
```
98112

@@ -101,12 +115,24 @@ or if a call fails
101115
| Status | Meaning
102116
|--------|--------
103117
| 0 | The operation was successful
104-
| 1 | Parameters were missing, out of range or non-parsable
105-
| 2 | The Device is DOWN or DISABLED (OperatingState / AdminState)
106-
| 3 | No such device or function
118+
| 1 | Request message format error
119+
| 2 | Parameters were missing, out of range or non-parsable
120+
| 3 | The Device is DOWN or DISABLED (OperatingState / AdminState)
121+
| 4 | No such device or function
107122
| 100+ | Implementation-specific errors, defined for each Device Service
108123

109-
** Device SDK enhancement **
124+
*Configuration*
125+
126+
The topic prefixes `edgex/request/function` and `edgex/response/function` will be configurable in the device services.
127+
128+
**Device SDK enhancement**
110129

111130
The device SDKs will handle the messagebus communcations and parameter marshalling. The generic errors defined above may be detected in this SDK code. The SDKs will define APIs for the individual device services to implement the function invocations.
112131

132+
**Command service enhancement**
133+
134+
The core-command service to be extended to provide access to device functions as it does for device readings and settings.
135+
136+
## References
137+
138+
* [ADR 0023-North-South-Messaging](https://github.com/edgexfoundry/edgex-docs/blob/master/docs_src/design/adr/0023-North-South-Messaging.md)

0 commit comments

Comments
 (0)