17
17
18
18
import com .rabbitmq .client .Channel ;
19
19
import com .rabbitmq .client .RpcClient ;
20
+ import com .rabbitmq .client .RpcClientParams ;
20
21
import com .rabbitmq .client .ShutdownSignalException ;
21
22
import com .rabbitmq .tools .json .JSONReader ;
22
23
import org .slf4j .Logger ;
@@ -67,6 +68,25 @@ public class JsonRpcClient extends RpcClient implements InvocationHandler {
67
68
*/
68
69
private ServiceDescription serviceDescription ;
69
70
71
+ /**
72
+ * Construct a new {@link JsonRpcClient}, passing the {@link RpcClientParams} through {@link RpcClient}'s constructor.
73
+ * <p>
74
+ * The service description record is
75
+ * retrieved from the server during construction.
76
+ *
77
+ * @param rpcClientParams
78
+ * @param mapper
79
+ * @throws IOException
80
+ * @throws JsonRpcException
81
+ * @throws TimeoutException
82
+ */
83
+ public JsonRpcClient (RpcClientParams rpcClientParams , JsonRpcMapper mapper )
84
+ throws IOException , JsonRpcException , TimeoutException {
85
+ super (rpcClientParams );
86
+ this .mapper = mapper ;
87
+ retrieveServiceDescription ();
88
+ }
89
+
70
90
/**
71
91
* Construct a new JsonRpcClient, passing the parameters through
72
92
* to RpcClient's constructor. The service description record is
@@ -76,7 +96,12 @@ public class JsonRpcClient extends RpcClient implements InvocationHandler {
76
96
*/
77
97
public JsonRpcClient (Channel channel , String exchange , String routingKey , int timeout , JsonRpcMapper mapper )
78
98
throws IOException , JsonRpcException , TimeoutException {
79
- super (channel , exchange , routingKey , timeout );
99
+ super (new RpcClientParams ()
100
+ .channel (channel )
101
+ .exchange (exchange )
102
+ .routingKey (routingKey )
103
+ .timeout (timeout )
104
+ );
80
105
this .mapper = mapper ;
81
106
retrieveServiceDescription ();
82
107
}
0 commit comments