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