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 module hunt.proton.engine.Session; 13 14 import hunt.collection.Map; 15 16 import hunt.proton.amqp.Symbol; 17 import hunt.proton.engine.Endpoint; 18 import hunt.proton.engine.Sender; 19 import hunt.proton.engine.Receiver; 20 import hunt.proton.engine.EndpointState; 21 import hunt.collection.Set; 22 import hunt.proton.engine.Connection; 23 24 /** 25 * Session 26 * 27 * Note that session level flow control is handled internally by Proton. 28 */ 29 interface Session : Endpoint 30 { 31 /** 32 * Returns a newly created sender endpoint 33 */ 34 public Sender sender(string name); 35 36 /** 37 * Returns a newly created receiver endpoint 38 */ 39 public Receiver receiver(string name); 40 41 public Session next(Set!EndpointState local, Set!EndpointState remote); 42 43 public Connection getConnection(); 44 45 public int getIncomingCapacity(); 46 47 public void setIncomingCapacity(int bytes); 48 49 public int getIncomingBytes(); 50 51 public int getOutgoingBytes(); 52 53 public long getOutgoingWindow(); 54 55 /** 56 * Sets the outgoing window size. 57 * 58 * @param outgoingWindowSize the outgoing window size 59 */ 60 public void setOutgoingWindow(long outgoingWindowSize); 61 62 /** 63 * Sets the local session properties, to be conveyed to the peer via the Begin frame when 64 * attaching the session to the session. 65 * 66 * Must be called during session setup, i.e. before calling the {@link #open()} method. 67 * 68 * @param properties 69 * the properties map to send, or null for none. 70 */ 71 void setProperties(Map!(Symbol, Object) properties); 72 73 /** 74 * Gets the local session properties. 75 * 76 * @return the properties map, or null if none was set. 77 * 78 * @see #setProperties(Map) 79 */ 80 Map!(Symbol, Object) getProperties(); 81 82 /** 83 * Gets the remote session properties, as conveyed from the peer via the Begin frame 84 * when opening the session. 85 * 86 * @return the properties Map conveyed by the peer, or null if there was none. 87 */ 88 Map!(Symbol, Object) getRemoteProperties(); 89 90 /** 91 * Sets the local session offered capabilities, to be conveyed to the peer via the Begin frame 92 * when opening the session. 93 * 94 * Must be called during session setup, i.e. before calling the {@link #open()} method. 95 * 96 * @param offeredCapabilities 97 * the offered capabilities array to send, or null for none. 98 */ 99 public void setOfferedCapabilities(Symbol[] offeredCapabilities); 100 101 /** 102 * Gets the local session offered capabilities. 103 * 104 * @return the offered capabilities array, or null if none was set. 105 * 106 * @see #setOfferedCapabilities(Symbol[]) 107 */ 108 Symbol[] getOfferedCapabilities(); 109 110 /** 111 * Gets the remote session offered capabilities, as conveyed from the peer via the Begin frame 112 * when opening the session. 113 * 114 * @return the offered capabilities array conveyed by the peer, or null if there was none. 115 */ 116 Symbol[] getRemoteOfferedCapabilities(); 117 118 /** 119 * Sets the local session desired capabilities, to be conveyed to the peer via the Begin frame 120 * when opening the session. 121 * 122 * Must be called during session setup, i.e. before calling the {@link #open()} method. 123 * 124 * @param desiredCapabilities 125 * the desired capabilities array to send, or null for none. 126 */ 127 public void setDesiredCapabilities(Symbol[] desiredCapabilities); 128 129 /** 130 * Gets the local session desired capabilities. 131 * 132 * @return the desired capabilities array, or null if none was set. 133 * 134 * @see #setDesiredCapabilities(Symbol[]) 135 */ 136 Symbol[] getDesiredCapabilities(); 137 138 /** 139 * Gets the remote session desired capabilities, as conveyed from the peer via the Begin frame 140 * when opening the session. 141 * 142 * @return the desired capabilities array conveyed by the peer, or null if there was none. 143 */ 144 Symbol[] getRemoteDesiredCapabilities(); 145 }