1 /*
2  * hunt-proton: AMQP Protocol library for D programming language.
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 
12 
13 module hunt.proton.amqp.messaging.Rejected;
14 
15 import hunt.proton.amqp.Symbol;
16 import hunt.proton.amqp.transport.DeliveryState;
17 import hunt.proton.amqp.transport.ErrorCondition;
18 import hunt.proton.amqp.messaging.Outcome;
19 
20 import std.concurrency : initOnce;
21 
22 class Rejected : DeliveryState, Outcome
23 {
24     //public static Symbol DESCRIPTOR_SYMBOL = Symbol.valueOf("amqp:rejected:list");
25 
26 
27     static Symbol DESCRIPTOR_SYMBOL()
28     {
29         __gshared Symbol inst;
30         return initOnce!inst(Symbol.valueOf("amqp:rejected:list"));
31     }
32 
33 
34     private ErrorCondition _error;
35 
36     public ErrorCondition getError()
37     {
38         return _error;
39     }
40 
41     public void setError(ErrorCondition error)
42     {
43         _error = error;
44     }
45 
46     public int size()
47     {
48         return _error !is null
49                   ? 1
50                   : 0;
51     }
52 
53 
54     override
55     public DeliveryStateType getType() {
56         return DeliveryStateType.Rejected;
57     }
58 }