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 module hunt.amqp.client.AmqpReceiver; 12 13 //import hunt.codegen.annotations.CacheReturn; 14 //import hunt.codegen.annotations.Nullable; 15 //import hunt.codegen.annotations.VertxGen; 16 //import hunt.core.AsyncResult; 17 //import hunt.core.Future; 18 //import hunt.core.Handler; 19 //import hunt.core.streams.ReadStream; 20 import hunt.amqp.client.ReadStream; 21 import hunt.amqp.client.AmqpMessage; 22 import hunt.amqp.Handler; 23 import hunt.amqp.client.AmqpConnection; 24 import hunt.Object; 25 /** 26 * Interface used to consume AMQP message as a stream of message. 27 * Back pressure is implemented using AMQP credits. 28 */ 29 interface AmqpReceiver : ReadStream!AmqpMessage { 30 31 32 AmqpReceiver exceptionHandler(Handler!Throwable handler); 33 34 35 AmqpReceiver handler( Handler!AmqpMessage handler); 36 37 38 AmqpReceiver pause(); 39 40 41 AmqpReceiver resume(); 42 43 44 AmqpReceiver fetch(long amount); 45 46 47 AmqpReceiver endHandler(Handler!Void endHandler); 48 49 /** 50 * The listened address. 51 * 52 * @return the address, not {@code null} 53 */ 54 string address(); 55 56 /** 57 * Closes the receiver. 58 * 59 * @param handler handler called when the receiver has been closed, can be {@code null} 60 */ 61 void close(Handler!Void handler); 62 63 /** 64 * Like {@link #close(Handler)} but returns a {@code Future} of the asynchronous result 65 */ 66 //Future<Void> close(); 67 68 /** 69 * Gets the connection having created the receiver. Cannot be {@code null} 70 * 71 * @return the connection having created the receiver. 72 */ 73 AmqpConnection connection(); 74 }