1 /*
2  * Copyright 2002-2018 the original author or authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 module hunt.stomp.simp.stomp.ReactorNettyTcpStompClient;
18 
19 // import hunt.stomp.tcp.TcpOperations;
20 // import hunt.stomp.tcp.reactor.ReactorNettyTcpClient;
21 
22 // import hunt.framework.util.concurrent.ListenableFuture;
23 
24 // /**
25 //  * A STOMP over TCP client that uses {@link ReactorNettyTcpClient}.
26 //  *
27 //  * @author Rossen Stoyanchev
28 //  * @since 5.0
29 //  */
30 // class ReactorNettyTcpStompClient : StompClientSupport {
31 
32 // 	private final TcpOperations!(byte[]) tcpClient;
33 
34 
35 // 	/**
36 // 	 * Create an instance with host "127.0.0.1" and port 61613.
37 // 	 */
38 // 	this() {
39 // 		this("127.0.0.1", 61613);
40 // 	}
41 
42 // 	/**
43 // 	 * Create an instance with the given host and port.
44 // 	 * @param host the host
45 // 	 * @param port the port
46 // 	 */
47 // 	ReactorNettyTcpStompClient(string host, int port) {
48 // 		this.tcpClient = initTcpClient(host, port);
49 // 	}
50 
51 // 	/**
52 // 	 * Create an instance with a pre-configured TCP client.
53 // 	 * @param tcpClient the client to use
54 // 	 */
55 // 	ReactorNettyTcpStompClient(TcpOperations!(byte[]) tcpClient) {
56 // 		assert(tcpClient, "'tcpClient' is required");
57 // 		this.tcpClient = tcpClient;
58 // 	}
59 
60 // 	private static ReactorNettyTcpClient!(byte[]) initTcpClient(string host, int port) {
61 // 		ReactorNettyTcpClient!(byte[]) client = new ReactorNettyTcpClient<>(host, port, new StompReactorNettyCodec());
62 // 		client.setLogger(SimpLogging.forLog(client.getLogger()));
63 // 		return client;
64 // 	}
65 
66 
67 // 	/**
68 // 	 * Connect and notify the given {@link StompSessionHandler} when connected
69 // 	 * on the STOMP level.
70 // 	 * @param handler the handler for the STOMP session
71 // 	 * @return a ListenableFuture for access to the session when ready for use
72 // 	 */
73 // 	ListenableFuture!(StompSession) connect(StompSessionHandler handler) {
74 // 		return connect(null, handler);
75 // 	}
76 
77 // 	/**
78 // 	 * An overloaded version of {@link #connect(StompSessionHandler)} that
79 // 	 * accepts headers to use for the STOMP CONNECT frame.
80 // 	 * @param connectHeaders headers to add to the CONNECT frame
81 // 	 * @param handler the handler for the STOMP session
82 // 	 * @return a ListenableFuture for access to the session when ready for use
83 // 	 */
84 // 	ListenableFuture!(StompSession) connect(StompHeaders connectHeaders, StompSessionHandler handler) {
85 // 		ConnectionHandlingStompSession session = createSession(connectHeaders, handler);
86 // 		this.tcpClient.connect(session);
87 // 		return session.getSessionFuture();
88 // 	}
89 
90 // 	/**
91 // 	 * Shut down the client and release resources.
92 // 	 */
93 // 	void shutdown() {
94 // 		this.tcpClient.shutdown();
95 // 	}
96 
97 // 	override
98 // 	string toString() {
99 // 		return "ReactorNettyTcpStompClient[" ~ this.tcpClient ~ "]";
100 // 	}
101 // }