blob: 89e51687570758f6c83e33f85b208c73003536f9 [file] [log] [blame]
Andrew Brownec843052016-09-02 21:26:06 -07001/*
2 * jndn-utils
3 * Copyright (c) 2016, Intel Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU Lesser General Public License,
7 * version 3, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT ANY
10 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
12 * more details.
13 */
14
15package com.intel.jndn.utils;
16
17import com.intel.jndn.utils.pubsub.Cancellation;
18import com.intel.jndn.utils.pubsub.On;
19import net.named_data.jndn.util.Blob;
20
21/**
22 * @author Andrew Brown, andrew.brown@intel.com
23 */
Andrew Brown770e00c2016-09-07 15:10:00 -070024public interface Subscriber extends AutoCloseable {
25 /**
26 * @param onMessage called every time a new message is received
27 * @param onError called every time an error occurs
28 * @return a cancellation token for stopping the subscription
29 */
Andrew Brownec843052016-09-02 21:26:06 -070030 Cancellation subscribe(On<Blob> onMessage, On<Exception> onError);
31}