Thursday, 19 December 2019

BIP32 and Public KCD

Hedera DEX

Thursday, 28 November 2019

How to stringify JSON for hashing and easy comparison in Java?

Or how to implement in Java?
    import com.fasterxml.jackson.databind.ObjectMapper;
    import com.fasterxml.jackson.databind.SerializationFeature;

    public static void stringify(final String jsonPath) throws Exception {
        final byte[] bytes = Files.readAllBytes(Paths.get(jsonPath));
        final String jsonData = new String(bytes);

        ObjectMapper om = new ObjectMapper();
        om.configure(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, true);
        Map map = om.readValue(jsonData, HashMap.class);
        String json = om.writeValueAsString(map);

Friday, 11 October 2019

Running the Solace VMR as an API Gateway on Ubuntu

Today's post is a step by step process to run the Solace VMR as an API Gateway.
There are several options for API gateways out there, but nothing comes close to the flexibility of the VMR.
This was tested on Ubuntu 18.

Run the VMR as a docker container
Execute the following: docker run -d --net=host --shm-size=2g --security-opt apparmor:unconfined --env username_admin_globalaccesslevel=admin --env username_admin_password=admin --name=solace solace/solace-pubsub-standard

You can use docker ps -a, or docker logs -f solace to check after a couple of minutes that all is well. Note that under Ubuntu you need to configure apparmor in unconfined mode for the VMR to run properly. Finally, also on Ubuntu, --net=host helps with network configuration if you test your set-up locally using a local micro-service.
I am using DockStation, a great Linux tool to manage containers.

Solace VMR configuration
Open a browser to point to http://localhost:8080 and login using the admin / admin credentials. Follow the steps to create a simple catch-all api gateway:
  • Click on "Message VPNs" then "default", then "services"
  • In the "REST" section, select "gateway", then "apply"
  • Under "Queues", create a queue "CATCH_ALL_Q", apply then select
  • Under "Subscriptions", create two subs: "GET/>" and "POST/>", those will catch all GET and POST requests
  • Under "Client Connections", select "REST", create "Delivery End Point" named "CATCH_ALL_DP", click "Enabled" and apply
  • Then select and go to "Queue Bindings", add one, and select "CATCH_ALL_Q"
  • Create a REST consumer "CATCH_ALL_RC", "Enabled" and select the host of your computer with port 9505, then apply. Under "Client Connections" the Operational State should be up if you have your micro-service listening on that port
In order to test it, execute "curl http://localhost:9000/ping" assuming you have a micro-service listening on port 9505, the VMR will act as an API Gateway - and forward the request to the micro-service. Voila!

Sunday, 6 October 2019

How to change folder's colors on Ubuntu 18

sudo apt-get update && sudo apt-get install folder-color

Blog Archive