1 /*
2 * hunt-amqp-client: AMQP Client Library for D Programming Language. Support for RabbitMQ and other AMQP Server.
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 modulehunt.amqp.client.AmqpSender;
12 13 importhunt.amqp.Handler;
14 importhunt.amqp.client.WriteStream;
15 importhunt.amqp.client.AmqpMessage;
16 importhunt.amqp.client.AmqpConnection;
17 18 importhunt.String;
19 importhunt.Object;
20 importhunt.concurrency.Future;
21 22 /**
23 * AMQP Sender interface used to send messages.
24 */25 interfaceAmqpSender : WriteStream!AmqpMessage {
26 27 28 AmqpSenderexceptionHandler(Handler!Throwablehandler);
29 30 31 AmqpSendersetWriteQueueMaxSize(intmaxSize);
32 33 /**
34 * Sends an AMQP message. The destination the configured sender address or the address configured in the message.
35 *
36 * @param message the message, must not be {@code null}
37 * @return the current sender
38 */39 // @Fluent40 AmqpSendersend(AmqpMessagemessage);
41 42 /**
43 * Sends an AMQP message and waits for an acknowledgement. The acknowledgement handler is called with an
44 * {@link AsyncResult} marked as failed if the message has been rejected or re-routed. If the message has been accepted,
45 * the handler is called with a success.
46 *
47 * @param message the message, must not be {@code null}
48 * @param acknowledgementHandler the acknowledgement handler, must not be {@code null}
49 * @return the current sender
50 */51 AmqpSendersendWithAck(AmqpMessagemessage, VoidAsyncHandleracknowledgementHandler);
52 53 /**
54 * Like {@link #sendWithAck(AmqpMessage, Handler)} but returns a {@code Future} of the asynchronous result
55 */56 //Future<Void> sendWithAck(AmqpMessage message);57 58 /**
59 * Closes the sender.
60 *
61 * @param handler called when the sender has been closed, must not be {@code null}
62 */63 voidclose(VoidAsyncHandlerhandler);
64 65 /**
66 * Like {@link #close(Handler)} but returns a {@code Future} of the asynchronous result
67 */68 Future!Voidclose();
69 70 /**
71 * @return the configured address.
72 */73 stringaddress();
74 75 /**
76 * Gets the connection having created the sender. Cannot be {@code null}
77 *
78 * @return the connection having created the sender.
79 */80 AmqpConnectionconnection();
81 }