@@ -86,16 +86,16 @@ var defaultReplyCorrelationIdExtractor CorrelationIdExtractor = func(message *am
8686// address for the reply queue. The function must return the modified message.
8787//
8888// The default `RequestPostProcessor` implementation (used when `RequestPostProcessor`
89- // is not explicitly set in `RpcClientOptions `) performs the following:
89+ // is not explicitly set in `RequesterOptions `) performs the following:
9090// - Assigns the `correlationID` to the `MessageID` property of the `amqp.Message`.
9191// - Sets the `ReplyTo` message property to a client-generated exclusive auto-delete queue.
9292type RequestPostProcessor func (request * amqp.Message , correlationID any ) * amqp.Message
9393
9494var DefaultRpcRequestTimeout = 30 * time .Second
9595
96- // RpcClientOptions is a struct that contains the options for the RPC client.
96+ // RequesterOptions is a struct that contains the options for the RPC client.
9797// It is used to configure the RPC client.
98- type RpcClientOptions struct {
98+ type RequesterOptions struct {
9999 // The name of the queue to send requests to. This queue must exist.
100100 //
101101 // Mandatory.
@@ -130,7 +130,7 @@ type outstandingRequest struct {
130130 // err error
131131}
132132
133- type amqpRpcClient struct {
133+ type amqpRequester struct {
134134 requestQueue ITargetAddress
135135 replyToQueue ITargetAddress
136136 publisher * Publisher
@@ -149,7 +149,7 @@ type amqpRpcClient struct {
149149// Close shuts down the RPC client, closing its underlying publisher and consumer.
150150// It ensures that all pending requests are cleaned up by closing their respective
151151// channels. This method is safe to call multiple times.
152- func (a * amqpRpcClient ) Close (ctx context.Context ) error {
152+ func (a * amqpRequester ) Close (ctx context.Context ) error {
153153 var err error
154154 a .closer .Do (func () {
155155 a .mu .Lock ()
@@ -173,7 +173,7 @@ func (a *amqpRpcClient) Close(ctx context.Context) error {
173173 return err
174174}
175175
176- func (a * amqpRpcClient ) Message (body []byte ) * amqp.Message {
176+ func (a * amqpRequester ) Message (body []byte ) * amqp.Message {
177177 return amqp .NewMessage (body )
178178}
179179
@@ -184,9 +184,9 @@ func (a *amqpRpcClient) Message(body []byte) *amqp.Message {
184184// an `outstandingRequest` is created and stored, and a channel is returned
185185// for the reply. The channel will be closed if the request times out or the
186186// client is closed before a reply is received.
187- func (a * amqpRpcClient ) Publish (ctx context.Context , message * amqp.Message ) (<- chan * amqp.Message , error ) {
187+ func (a * amqpRequester ) Publish (ctx context.Context , message * amqp.Message ) (<- chan * amqp.Message , error ) {
188188 if a .isClosed () {
189- return nil , fmt .Errorf ("rpc client is closed" )
189+ return nil , fmt .Errorf ("requester is closed" )
190190 }
191191 replyTo , err := a .replyToQueue .toAddress ()
192192 if err != nil {
@@ -220,7 +220,7 @@ func (a *amqpRpcClient) Publish(ctx context.Context, message *amqp.Message) (<-c
220220 return ch , nil
221221}
222222
223- func (a * amqpRpcClient ) isClosed () bool {
223+ func (a * amqpRequester ) isClosed () bool {
224224 a .mu .Lock ()
225225 defer a .mu .Unlock ()
226226 return a .closed
@@ -231,7 +231,7 @@ func (a *amqpRpcClient) isClosed() bool {
231231// If a request's `sentAt` timestamp is older than the `requestTimeout`,
232232// its channel is closed, and the request is removed from `pendingRequests`.
233233// The goroutine exits when the `done` channel is closed, typically when the client is closed.
234- func (a * amqpRpcClient ) requestTimeoutTask () {
234+ func (a * amqpRequester ) requestTimeoutTask () {
235235 t := time .NewTicker (a .requestTimeout )
236236 defer t .Stop ()
237237 for {
@@ -260,7 +260,7 @@ func (a *amqpRpcClient) requestTimeoutTask() {
260260// corresponding request's channel, and the request is removed from `pendingRequests`.
261261// If no match is found, the message is requeued. The goroutine exits when the `done`
262262// channel is closed, typically when the client is closed.
263- func (a * amqpRpcClient ) messageReceivedHandler () {
263+ func (a * amqpRequester ) messageReceivedHandler () {
264264 for {
265265 select {
266266 case <- a .done :
0 commit comments