SNP4J

An api to send notification to Snarl

License

License

GroupId

GroupId

fr.jcgay.snp4j
ArtifactId

ArtifactId

snp4j
Last Version

Last Version

0.3
Release Date

Release Date

Type

Type

jar
Description

Description

SNP4J
An api to send notification to Snarl
Source Code Management

Source Code Management

https://github.com/jcgay/snp4j

Download snp4j

How to add to project

<!-- https://jarcasting.com/artifacts/fr.jcgay.snp4j/snp4j/ -->
<dependency>
    <groupId>fr.jcgay.snp4j</groupId>
    <artifactId>snp4j</artifactId>
    <version>0.3</version>
</dependency>
// https://jarcasting.com/artifacts/fr.jcgay.snp4j/snp4j/
implementation 'fr.jcgay.snp4j:snp4j:0.3'
// https://jarcasting.com/artifacts/fr.jcgay.snp4j/snp4j/
implementation ("fr.jcgay.snp4j:snp4j:0.3")
'fr.jcgay.snp4j:snp4j:jar:0.3'
<dependency org="fr.jcgay.snp4j" name="snp4j" rev="0.3">
  <artifact name="snp4j" type="jar" />
</dependency>
@Grapes(
@Grab(group='fr.jcgay.snp4j', module='snp4j', version='0.3')
)
libraryDependencies += "fr.jcgay.snp4j" % "snp4j" % "0.3"
[fr.jcgay.snp4j/snp4j "0.3"]

Dependencies

compile (1)

Group / Artifact Type Version
org.slf4j : slf4j-api jar 1.7.12

provided (1)

Group / Artifact Type Version
org.projectlombok : lombok jar 1.16.6

test (4)

Group / Artifact Type Version
org.assertj : assertj-core jar 1.7.1
junit : junit jar 4.12
org.mockito : mockito-core jar 2.0.31-beta
ch.qos.logback : logback-classic jar 1.1.3

Project Modules

There are no modules declared in this project.

#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

Versions

Version
0.3
0.2