D3adspaceEnterprises/reincarnation

Name: reincarnation

Owner: D3adspace Enterprises

Description: Just another random pub sub implementation

Created: 2017-04-12 12:57:55.0

Updated: 2017-07-03 07:13:32.0

Pushed: 2017-07-04 17:46:15.0

Homepage:

Size: 71

Language: Java

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Reincarnation

We dont recommend to use this software anymore. Look at the reworked version at: https://github.com/D3adspaceEnterprises/heimdall

Usage:

 -jar reincarnation-server-1.2.0-SNAPSHOT.jar -h <host> -p <port>
ava

opyright (c) 2017 D3adspace
ermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
ocumentation files (the "Software"), to deal in the Software without restriction, including without limitation the
ights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
ersons to whom the Software is furnished to do so, subject to the following conditions:

he above copyright notice and this permission notice shall be included in all copies or substantial portions of the
oftware.

HE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
OT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
ONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.




rt de.d3adspace.reincarnation.client.PubSubClient;
rt de.d3adspace.reincarnation.client.network.ReincarnationPubSubClientFactory;
rt de.d3adspace.reincarnation.client.network.handler.ReincarnationSubscriptionHandler;
rt de.d3adspace.reincarnation.commons.annotation.SubscriptionChannel;
rt org.json.JSONObject;

ic class Main {
public static void main(String[] args) {
    final PubSubClient pubSubClient = ReincarnationPubSubClientFactory.createPubSubClient("localhost", 10000);

    pubSubClient.subscribe(new CustomHandler());

    pubSubClient.publish("example", new JSONObject().put("text", "test!"));

    pubSubClient.unsubscribe("example");

    pubSubClient.disconnect();
}

@SubscriptionChannel(channelName = "example")
private static class CustomHandler implements ReincarnationSubscriptionHandler {

    @Override
    public void onMessage(JSONObject jsonObject) {
        System.out.println("Publish in example: " + jsonObject.toString());
    }
}


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.