-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat(client): Add Telemetry APIs (#15047)
- Loading branch information
Showing
4 changed files
with
234 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
...s-core/src/main/java/com/azure/digitaltwins/core/util/PublishTelemetryRequestOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package com.azure.digitaltwins.core.util; | ||
|
||
import com.azure.core.annotation.Fluent; | ||
|
||
import java.time.OffsetDateTime; | ||
import java.time.ZoneOffset; | ||
import java.util.UUID; | ||
|
||
/** | ||
* The additional information to be used when processing a telemetry request. | ||
*/ | ||
@Fluent | ||
public final class PublishTelemetryRequestOptions { | ||
|
||
/** | ||
* A unique message identifier (within the scope of the digital twin id) that is commonly used for de-duplicating messages. | ||
* Defaults to a random guid. | ||
*/ | ||
private String messageId = UUID.randomUUID().toString(); | ||
|
||
/** | ||
* An RFC 3339 timestamp that identifies the time the telemetry was measured. | ||
* It defaults to the current date/time UTC. | ||
*/ | ||
private OffsetDateTime timestamp = OffsetDateTime.now(ZoneOffset.UTC); | ||
|
||
/** | ||
* Gets the message Id. | ||
* @return A unique message identifier (within the scope of the digital twin id) that is commonly used for de-duplicating messages. | ||
*/ | ||
public String getMessageId() { | ||
return this.messageId; | ||
} | ||
|
||
/** | ||
* Gets the timestamp. | ||
* @return The timestamp that identifies the time the telemetry was measured. | ||
*/ | ||
public OffsetDateTime getTimestamp() { | ||
return this.timestamp; | ||
} | ||
|
||
/** | ||
* Set the message Id | ||
* @param messageId A unique message identifier (within the scope of the digital twin id) that is commonly used for de-duplicating messages. | ||
* @return The PublishTelemetryRequestOptions object itself. | ||
*/ | ||
public PublishTelemetryRequestOptions setMessageId(String messageId) { | ||
this.messageId = messageId; | ||
return this; | ||
} | ||
|
||
/** | ||
* Set the timestamp | ||
* @param timestamp The timestamp that identifies the time the telemetry was measured. | ||
* @return The PublishTelemetryRequestOptions object itself. | ||
*/ | ||
public PublishTelemetryRequestOptions setTimestamp(OffsetDateTime timestamp) { | ||
this.timestamp = timestamp; | ||
return this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters