Push Notifications

General Overview

Standard behaviour

The normal behaviour of agrirouter is to put incoming messages from other endpoints to the feed of the receiving endpoint (1).

The app instance can send a request for messages to its endpoint (2), agrirouter will search for messages in the feed (3), so that they are forwarded to the outbox (4), where they can be requested from (REST) or will directly be delivered (MQTT)(5).

Received messages need to be confirmed (6) to delete the message from the feed (7).

Receiving messages through feed
Figure 1. Receiving messages through feed

Push Notifications

With push notifications activated, a copy of each message sent to the feed (1) is directly copied to the outbox (2) and delivered to the app instance (directly via MQTT or through polling using HTTP) (3). Pushed messages need to be confirmed (4) as well as requested messages to be deleted from the feed (5).

Receiving messages with push notifications
Figure 2. Receiving messages with push notifications

Messages in the outbox persist for a short time, currently 5 minutes. If an app instance was not connected to agrirouter for a while, the messages will be deleted from the outbox, however, they persist in the message feed.

Every app instance should therefore check its feed in a periodic manner. Depending on the use case, this should be a frequency between 1 and 24 hours.

Additionally, in interactive systems, you should give your user the possibility to force a feed check.

Push notifications can be activated through the Capabilities command.

Analyze Push Messages

A push message will be received directly through the outbox without any command sent to the inbox.

ResultCode

PUSH_NOTIFICATION

Protobuf Schema

agrirouter.feed.push.notification.proto

TypeURL

types.agrirouter/agrirouter.feed.push.notification

The push message element includes

# Name Type Description

1

messages

[FeedMessage]

An array of FeedMessages

For the first release, the push message array will always include only one entry. If multiple messages shall be delivered, multiple Push notifications are delivered; each including one message.

However, make sure that you check the possible multiple FeedMessages delivered with foreach functionalities to be future proof

Each message includes a header and a payload:

# Name Type Description

1

header

Header

The header of the message

2

content

Any

An "Any"-Object including the payload

The header includes the basic information about the message and equals the message headers received from the feed.

# Name Type Description

1

receiver_id

string

The ID of the receiver of the message. This can be the app itself, an attached machine or a Virtual CU

2

technical_message_type

string

The technical message type of the message

3

team_set_context_id

string

The teamset ID to assign the message to the correct context.

4

chunk_context

agrirouter.commons.ChunkComponent

The chunk component

5

payload_size

int64

The size of the payload

6

sent_timestamp

timestamp

The timestamp that was provided by the sender. It should be the recording time point

7

sequence_number

int64

The sequence number to determine the correct order for messages that were recorded at the same time point

8

sender_id

string

The endpoint ID of the sender

9

created_at

Timestamp

The timestamp, when this message was added to the receiving endpoints feed

10

message_id

String

Internal agrirouter message ID representing this message and its payload

11

metadata

agrirouter.commons.Metadata

Additional metadata information to help differentiate between messages of the same type

In case of a chunked message, the meta information will always be available in every single message.

There is no paging mechanism available in Push notifications All messages will be delivered in responses with a maximum size of 1 MB. So, as long as you receive push notifications, you should keep on polling if there are more of them.

Metadata

From Release 1.2 of the agrirouter, messages can be extended by metadata to provide further information.

The metadata field includes the following fields:

# Name Type Description

1

file_name

string

The corresponding file name of the sent file; relevant e.g. if multiple TaskDataSets are sent.

Delivery Order

While messages from the feed are delivered "in order", messages directly pushed might be unsorted; chunked file messages could for example "overtake" each other on the way from Endpoint 1 to Endpoint 2.