Git Product home page Git Product logo

heimdall's Introduction

Heimdall

Heimdall is supposed to be a lightweight and easy to use pub sub communication framework you can build your infrastructure on.

Installation / Usage

  • Install Maven
  • Clone this repo
  • Install: mvn clean install

Maven dependencies

Client:

<dependency>
  <groupId>de.d3adspace</groupId>
  <artifactId>heimdall-client</artifactId>
  <version>1.0.0-SNAPSHOT</version>
</dependency>

Server:

<dependency>
  <groupId>de.d3adspace</groupId>
  <artifactId>heimdall-server</artifactId>
  <version>1.0.0-SNAPSHOT</version>
</dependency>

Commons:

<dependency>
  <groupId>de.d3adspace</groupId>
  <artifactId>heimdall-commons</artifactId>
  <version>1.0.0-SNAPSHOT</version>
</dependency>

Example

Server:

package de.d3adspace.heimdall.client;

import de.d3adspace.heimdall.server.HeimdallServer;
import de.d3adspace.heimdall.server.HeimdallServerFactory;
import de.d3adspace.heimdall.server.config.HeimdallServerConfig;
import de.d3adspace.heimdall.server.config.HeimdallServerConfigBuilder;

public class HeimdallServerExample {

	public static void main(String[] args) {
		HeimdallServerConfig config = new HeimdallServerConfigBuilder()
			.setServerHost("localhost")
			.setServerPort(1337)
			.createHeimdallServerConfig();

		HeimdallServer heimdallServer = HeimdallServerFactory.createHeimdallServer(config);
		heimdallServer.start();
	}
}

Client:

package de.d3adspace.heimdall.client;

import de.d3adspace.heimdall.client.HeimdallClient;
import de.d3adspace.heimdall.client.HeimdallClientFactory;
import de.d3adspace.heimdall.client.annotation.Channel;
import de.d3adspace.heimdall.client.config.HeimdallClientConfig;
import de.d3adspace.heimdall.client.config.HeimdallClientConfigBuilder;
import de.d3adspace.heimdall.client.handler.PacketHandler;
import org.json.JSONObject;

public class HeimdallClientExample {

	public static void main(String[] args) {
		HeimdallClientConfig config = new HeimdallClientConfigBuilder()
			.setServerHost("localhost")
			.setServerPort(1337)
			.createHeimdallClientConfig();

		HeimdallClient client = HeimdallClientFactory.createHeimdallClient(config);
    client.connect();

		PacketHandler packetHandler = new PacketHandlerExample();
		client.subscribe(packetHandler);

		client.publish("cluster", new JSONObject().put("Hello", "World!"));

		client.unsubscribe(packetHandler);

		client.disconnect();
	}
}
package de.d3adspace.heimdall.client;

import de.d3adspace.heimdall.client.annotation.Channel;
import de.d3adspace.heimdall.client.handler.PacketHandler;
import org.json.JSONObject;

@Channel("cluster")
public class PacketHandlerExample implements PacketHandler {

	public void handlePacket(JSONObject jsonObject) {
		System.out.println("Message in cluster: " + jsonObject);
	}
}

heimdall's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar felixklauke avatar rubyhale avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

heimdall's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.