Package se.arkalix.net.http.consumer

HTTP Consumer Utilities

This package most significantly contains the HttpConsumer class, which is useful for sending HTTP requests to remote Arrowhead services.

This package distinguishing itself form the HTTP Client Utilities package by relying heavily on the availability of relevant service descriptions. Such can most adequately be retrieved via the using() method of the ServiceQuery class, an instance of which is returned by the ArSystem#consume() method. It effectively allows calls as the following naive example:

     system.consume()
         .name("the-service-name")
         .encoding(EncodingDescriptor.JSON)
         .using(HttpConsumer.factory())
         .flatMap(consumer -> consumer.send(new HttpConsumerRequest()
            {...})
         .flatMap(HttpConsumerResponse::bodyAsString)
         .ifSuccess(body -> System.out.println(body))
         .onFailure(Throwable::printStackTrace);
 
It should be noted that all functionality provided by this package is non-blocking by virtue of all I/O operations being handled by the Kalix schedulers.