jcgay / snp4j

A Snarl SNP Java implementation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

#SNP4J

A blocking implementation of the SNP protocol to talk with Snarl.

##Usage

  1. Create the destination,
  2. Define an application,
  3. Initialize the notifier,
  4. Create a notification,
  5. Send the notification,
  6. Release resources.
	Server destination = Server.builder()
                .withHost("localhost")
                .withPort(9887)
                .build();
	Application application = Application.of("application/x-vnd-apache.maven", "Maven");
	Notifier notifier = SnpNotifier.of(application, destination);
	
	Notification notification = new Notification();
	notification.setText("Hello World !");
	notification.setTitle("First notification");
	
	try {
    	notifier.send(notification);
    } finally {
        Closeables.closeQuietly(notifier);
    }

The application is automatically registered against Snarl, and unregistered when closing resource.

##Installation

Add dependency with your favorite build tool.

Example with Maven:

    <dependencies>
        <dependency>
            <groupId>com.github.jcgay.snp4j</groupId>
            <artifactId>snp4j</artifactId>
            <version>0.3</version>
        </dependency>
    </dependencies>

Build status

Build Status Coverage Status

Release

mvn -B release:prepare release:perform

About

A Snarl SNP Java implementation

License:MIT License


Languages

Language:Java 100.0%