1 /*
2  * hunt-amqp: AMQP library for D programming language, based on hunt-net.
3  *
4  * Copyright (C) 2018-2019 HuntLabs
5  *
6  * Website: https://www.huntlabs.net
7  *
8  * Licensed under the Apache-2.0 License.
9  *
10  */
11 module hunt.amqp.streams.ProtonPublisher;
12 
13 import hunt.proton.amqp.transport.Source;
14 import hunt.proton.amqp.transport.Target;
15 import hunt.amqp.streams.Publisher;
16 
17 /*
18  * An AMQP consumer, presented as a reactive streams Publisher
19  */
20 interface ProtonPublisher(T) : Publisher!T {
21 
22   /**
23    * Retrieves the address from the remote source details. Should only be called in callbacks such
24    * as on onSubscribe() to ensure detail is populated and safe threading.
25    *
26    * @return the remote address, or null if there was none.
27    */
28   string getRemoteAddress();
29 
30   /**
31    * Sets the local Source details. Only useful to call before subscribing.
32    *
33    * @param source
34    *          the source
35    * @return the publisher
36    */
37   ProtonPublisher!T setSource(Source source);
38 
39   /**
40    * Retrieves the local Source details for access or customisation.
41    *
42    * @return the local Source, or null if there was none.
43    */
44   Source getSource();
45 
46   /**
47    * Sets the local Target details. Only useful to call before subscribing.
48    *
49    * @param target
50    *          the target
51    * @return the publisher
52    */
53   ProtonPublisher!T setTarget(Target target);
54 
55   /**
56    * Retrieves the local Target details for access or customisation.
57    *
58    * @return the local Target, or null if there was none.
59    */
60   Target getTarget();
61 
62   /**
63    * Retrieves the remote Source details. Should only be called in callbacks such
64    * as on onSubscribe() to ensure detail is populated and safe threading.
65    *
66    * @return the remote Source, or null if there was none.
67    */
68   Source getRemoteSource();
69 
70   /**
71    * Retrieves the remote Target details. Should only be called in callbacks such
72    * as on onSubscribe() to ensure detail is populated and safe threading.
73    *
74    * @return the remote Target, or null if there was none.
75    */
76   Target getRemoteTarget();
77 }