Integrating with the Hyper infrastructure is easy (we hope).
First, you need to deploy the hyper server together
with the settings and certificates we've provided to you. This is
as easy as downloading the latest hyper version from
our server, unpacking the settings archive we've provided you with
and running
HYPER_SETTINGS=path/to/settingshyperserverrun
This should open a local JSON-RPC server on port
5555 that you can connect to via TLS (you'll need to
add the root CA certificate to your certificate chain for this).
This server is your gateway to all Hyper services. Simply look up
the services that a specific operator provides and send a request
that contains the name of the operator and the service method you
want to call. For example, to interact with a "locations" service
provided by operator "ls-1", you'd simply post a JSON RPC message
like this:
The gateway will take care of routing this message to the
correct service and returning a response to you.
If you want to accept requests from other services in the Hyper
ecosystem you can use the jsonrpc_client, simply
specifying an API endpoint that incoming requests will be delivered
to using the same syntax as above.
That's it!
Asynchronous Calls
The calls we've seen above were all synchronous, i.e. making a
call resulted in a direct response. Sometimes calls need to be
asynchronous though, e.g. because replying to them takes time. If
you make an asynchronous call to another service, you'll get back
an acknowledgment first. As soon as the service you've called has a
response ready, it will send it back to your via the
hyper network, using the same id you
provided (which enables you to match the response to your request).
Likewise, you can respond to calls from other services in an
asynchronous way, simply pushing the response to your local
JSON-RPC server with a method name respond (without a
service name). Do not forget to include the same id
that you received with the original request, as this will contain
the "return address" of the request.
Integration Example
To get a concrete idea of how to integrate with the Hyper
infrastructure using the Hyper server we have created a simple demo
setup that illustrates all components. The demo consists of three
components:
An hyper server simulating a health
department, named hd-1
An hyper server simulation an operator offering a
"locations" service, named ls-1
The actual location service hyper-ls offered by
the operator ls-1
Getting Up And Running
First, please check the README on how to create all necessary
TLS certificates and build the software. Then, start the individual
services on different terminals:
# run the `hyper` server of the "locations" operator ls-1HYPER_SETTINGS=settings/dev/roles/ls-1hyper--leveldebugserverrun
# run the `hyper` server of the health department hd-1HYPER_SETTINGS=settings/dev/roles/hd-1hyper--leveldebugserverrun
# run the "locations" service
hyper-ls
Testing
Now your system should be up and running. The demo "locations"
service provides a simple, authenticationless JSON-RPC interface
with two methods: add, which will add a location to
the database, and lookup, which will look up a
location based on its name. For example, to add a
location to the service:
The request first went to the health department's
hyper server, was first routed to ls-1's
hyper server via gRPC and was then passed to the
JSON-RPC API of the local hyper-ls service running
there. The result was then passsed back along the entire chain.
You can also perform a lookup of the location you've just
added:
Hence, interacting with the remote "locations" service is just
like calling a local JSON-RPC service, except that you specify the
name of the operator running the service, ls-1.lookup,
instead of just calling lookup.
Integration
Integrating with the Hyper infrastructure is easy (we hope). First, you need to deploy the
hyper
server together with the settings and certificates we've provided to you. This is as easy as downloading the latesthyper
version from our server, unpacking the settings archive we've provided you with and runningThis should open a local JSON-RPC server on port
5555
that you can connect to via TLS (you'll need to add the root CA certificate to your certificate chain for this). This server is your gateway to all Hyper services. Simply look up the services that a specific operator provides and send a request that contains the name of the operator and the service method you want to call. For example, to interact with a "locations" service provided by operator "ls-1", you'd simply post a JSON RPC message like this:The gateway will take care of routing this message to the correct service and returning a response to you.
If you want to accept requests from other services in the Hyper ecosystem you can use the
jsonrpc_client
, simply specifying an API endpoint that incoming requests will be delivered to using the same syntax as above.That's it!
Asynchronous Calls
The calls we've seen above were all synchronous, i.e. making a call resulted in a direct response. Sometimes calls need to be asynchronous though, e.g. because replying to them takes time. If you make an asynchronous call to another service, you'll get back an acknowledgment first. As soon as the service you've called has a response ready, it will send it back to your via the
hyper
network, using the sameid
you provided (which enables you to match the response to your request). Likewise, you can respond to calls from other services in an asynchronous way, simply pushing the response to your local JSON-RPC server with a method namerespond
(without a service name). Do not forget to include the sameid
that you received with the original request, as this will contain the "return address" of the request.Integration Example
To get a concrete idea of how to integrate with the Hyper infrastructure using the Hyper server we have created a simple demo setup that illustrates all components. The demo consists of three components:
hyper
server simulating ahealth department
, namedhd-1
hyper
server simulation an operator offering a "locations" service, namedls-1
hyper-ls
offered by the operatorls-1
Getting Up And Running
First, please check the README on how to create all necessary TLS certificates and build the software. Then, start the individual services on different terminals:
Testing
Now your system should be up and running. The demo "locations" service provides a simple, authenticationless JSON-RPC interface with two methods:
add
, which will add a location to the database, andlookup
, which will look up a location based on itsname
. For example, to add a location to the service:This should return a simple JSON response:
The request first went to the health department's
hyper
server, was first routed tols-1
'shyper
server via gRPC and was then passed to the JSON-RPC API of the localhyper-ls
service running there. The result was then passsed back along the entire chain.You can also perform a lookup of the location you've just added:
which should return
Hence, interacting with the remote "locations" service is just like calling a local JSON-RPC service, except that you specify the name of the operator running the service,
ls-1.lookup
, instead of just callinglookup
.