/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package avis.test.hello;

import java.util.Date;
import org.avis.client.Elvin;
import org.avis.client.Notification;

/**
 *
 * @author dhaval
 */
public class Publisher {

    private Elvin elvin;

    public Publisher() throws Exception{
        elvin = new Elvin("elvin://localhost");
    }


    public void startSending() throws Exception{
        int i=0;
        while (true) {
            Notification notification = new Notification();
            notification.set("Name", "Dhaval");
            notification.set("Time", new Date().toString());
            notification.set("Counter", i );
            elvin.send(notification);
            i++;
            Thread.sleep(1000);
        }
    }

    public static void main(String[] args) throws Exception{
        new Publisher().startSending();
    }
}
