@@ -50,7 +50,7 @@ This project started as a fork from https://github.com/PelionIoT/java-coap, but
5050Runtime requirements
5151------------
5252
53- * JRE 8, 11, 17
53+ * JRE 8, 17, 21
5454
5555Using the Library
5656-----------------
@@ -65,6 +65,8 @@ dependencies {
6565 implementation(" io.github.open-coap:coap-core:VERSION" )
6666 implementation(" io.github.open-coap:coap-mbedtls:VERSION" ) // for DTLS support
6767 implementation(" io.github.open-coap:coap-tcp:VERSION" ) // for coap over tcp support
68+ implementation(" io.github.open-coap:coap-metrics:VERSION" ) // for micrometer integration
69+ implementation(" io.github.open-coap:coap-netty:VERSION" ) // for netty integration
6870}
6971```
7072
@@ -111,7 +113,7 @@ client = CoapServer.builder()
111113 return true ; // return false to terminate observation
112114 })
113115 // (optional) set custom observation relation store, for example one that will use external storage
114- .observationRelationsStore (new HashMapObservationRelations ())
116+ .observationsStore (new HashMapObservationsStore ())
115117 // (optional) define maximum block size
116118 .blockSize(BlockSize . S_1024 )
117119 // (optional) set maximum response timeout, default for every request
@@ -164,7 +166,7 @@ client.close();
164166
165167``` java
166168// define subscription manager for observable resources
167- InboundSubscriptionManager subscriptionManager = new InboundSubscriptionManager ();
169+ ObserversManager observersManager = new ObserversManager ();
168170
169171server = CoapServer . builder()
170172 // configure with plain text UDP transport, listening on port 5683
@@ -180,13 +182,13 @@ server = CoapServer.builder()
180182 return coapResponse(Code . C204_CHANGED ). toFuture();
181183 })
182184 // observable resource
183- .get(" /sensors/temperature" , subscriptionManager . then(req - >
184- completedFuture( CoapResponse . ok(" 21C" ))
185+ .get(" /sensors/temperature" , observersManager . then(req - >
186+ CoapResponse . ok(" 21C" ). toFuture( )
185187 ))
186188 )
187189 .build();
188190
189- subscriptionManager . init(server);
191+ observersManager . init(server);
190192server. start();
191193```
192194
0 commit comments