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.ProtonClient;
12 
13 import hunt.amqp.Handler;
14 import hunt.amqp.impl.ProtonClientImpl;
15 import hunt.amqp.ProtonConnection;
16 import hunt.amqp.ProtonClientOptions;
17 /**
18  * @author <a href="http://tfox.org">Tim Fox</a>
19  */
20 interface ProtonClient {
21 
22   /**
23    * Create a ProtonClient instance with the given Vertx instance.
24    *
25    * @param vertx
26    *          the vertx instance to use
27    * @return the client instance
28    */
29   static ProtonClient create() {
30     return new ProtonClientImpl();
31   }
32 
33   /**
34    * Connect to the given host and port, without credentials.
35    *
36    * @param host
37    *          the host to connect to
38    * @param port
39    *          the port to connect to
40    * @param connectionHandler
41    *          handler that will process the result, giving either the (unopened) ProtonConnection or failure cause.
42    */
43   void connect(string host, int port, Handler!ProtonConnection connectionHandler);
44 
45   /**
46    * Connect to the given host and port, with credentials (if required by server peer).
47    *
48    * @param host
49    *          the host to connect to
50    * @param port
51    *          the port to connect to
52    * @param username
53    *          the user name to use in any SASL negotiation that requires it
54    * @param password
55    *          the password to use in any SASL negotiation that requires it
56    * @param connectionHandler
57    *          handler that will process the result, giving either the (unopened) ProtonConnection or failure cause.
58    */
59   void connect(string host, int port, string username, string password,
60                Handler!ProtonConnection connectionHandler);
61 
62   /**
63    * Connect to the given host and port, without credentials.
64    *
65    * @param options
66    *          the options to apply
67    * @param host
68    *          the host to connect to
69    * @param port
70    *          the port to connect to
71    * @param connectionHandler
72    *          handler that will process the result, giving either the (unopened) ProtonConnection or failure cause.
73    */
74   void connect(ProtonClientOptions options, string host, int port,
75                Handler!ProtonConnection connectionHandler);
76 
77   /**
78    * Connect to the given host and port, with credentials (if required by server peer).
79    *
80    * @param options
81    *          the options to apply
82    * @param host
83    *          the host to connect to
84    * @param port
85    *          the port to connect to
86    * @param username
87    *          the user name to use in any SASL negotiation that requires it
88    * @param password
89    *          the password to use in any SASL negotiation that requires it
90    * @param connectionHandler
91    *          handler that will process the result, giving either the (unopened) ProtonConnection or failure cause.
92    */
93   void connect(ProtonClientOptions options, string host, int port, string username, string password,
94                Handler!ProtonConnection connectionHandler);
95 }