https://github.com/ctron/kapua-gateway-client
A Gateway Client SDK for Eclipse Kapua™
https://github.com/ctron/kapua-gateway-client
eclipse-iot iot iot-gateway
Last synced: about 1 year ago
JSON representation
A Gateway Client SDK for Eclipse Kapua™
- Host: GitHub
- URL: https://github.com/ctron/kapua-gateway-client
- Owner: ctron
- License: epl-1.0
- Created: 2017-05-16T16:08:13.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-07-20T09:10:08.000Z (almost 9 years ago)
- Last Synced: 2025-04-01T08:26:14.419Z (about 1 year ago)
- Topics: eclipse-iot, iot, iot-gateway
- Language: Java
- Homepage:
- Size: 898 KB
- Stars: 9
- Watchers: 5
- Forks: 3
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: license.html
Awesome Lists containing this project
README
# Eclipse Kapua™ Gateway Client SDK [](https://travis-ci.org/ctron/kapua-gateway-client) [](https://search.maven.org/#search%7Cga%7C1%7Cg%3A%22de.dentrassi.kapua%22)
This project provides an SDK for connecting to [Eclipse Kapua](https://eclipse.org/kapua) as a gateway.
**Note:** This is not part of the Eclipse Kapua project.
This project should provide a simple to use SDK for pushing telemetry data into Kapua
and consuming command messages out of Kapua.
**Note:** This is a work in progress and should not be considered production ready.
## How to use
The following quick steps should provide you with a working example.
### Add to your Maven project
```xml
de.dentrassi.kapua
kapua-gateway-client-provider-mqtt-fuse
de.dentrassi.kapua
kapua-gateway-client-profile-kura
```
### Example client
```java
import static org.eclipse.kapua.gateway.client.Credentials.userAndPassword;
import static org.eclipse.kapua.gateway.client.Errors.ignore;
import org.eclipse.kapua.gateway.client.mqtt.fuse.FuseClient;
import org.eclipse.kapua.gateway.client.profile.kura.KuraMqttProfile;
try (Client client = KuraMqttProfile.newProfile(FuseClient.Builder::new)
.accountName("kapua-sys")
.clientId("foo-bar-1")
.brokerUrl("tcp://localhost:1883")
.credentials(userAndPassword("kapua-broker", "kapua-password"))
.build()) {
try (Application application = client.buildApplication("app1").build()) {
// subscribe to a topic
application.data(Topic.of("my", "receiver")).subscribe(message -> {
System.out.format("Received: %s%n", message);
});
// cache sender instance
Sender sender = application
.data(Topic.of("my", "sender"))
.errors(ignore());
int i = 0;
while (true) {
// send
sender.send(Payload.of("counter", i++));
Thread.sleep(1000);
}
}
}
```