|
| 1 | +# Status Codes |
| 2 | +The response generated will have internal status codes for each and every event based on the input JSON provided. |
| 3 | + |
| 4 | +Status codes are generated according to the below tables. |
| 5 | + |
| 6 | +## Internal status codes |
| 7 | + |
| 8 | +Below is the status codes: |
| 9 | + |
| 10 | +| Status code | Result | Message | Comment | |
| 11 | +|-------------|-------------------------------|-------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |
| 12 | +| 200 | SUCCESS | Event sent successfully | Is returned if the request is completed successfully. | |
| 13 | +| 207 | Multi-Status | | Is returned if we have a mix of internal status codes. Eg: publish of few events was successful and few events was a failure. In case of multiple events in the body JSON, if a event is given internal status code of 400 or 500 rest events will not be published and will be given a internal status code of 503, which will result in overall HTTP response code of 207. | |
| 14 | +| 400 | Bad Request | Invalid event content, client need to fix problem in event before submitting again. | Is returned if the request body JSON is malformed. Eg: unable to parse the body JSON. | |
| 15 | +| 404 | RabbitMQ properties not found | RabbitMQ properties not configured for the protocol <protocol> | Is returned if RabbitMQ message broker properties are not found for the protocol used by event. | |
| 16 | +| 500 | Internal Server Error | RabbitMQ is down. Please try later | Is returned if RabbitMQ is down. | |
| 17 | +| | | Could not prepare Routing key to publish message. | Is returned if could not prepare routing key to publish the eiffel event. | |
| 18 | +| 503 | Service Unavailable | Please check previous event and try again later | Is returned if there is a failure in publishing previous event with status code 400, 404 or 500. | |
| 19 | + |
| 20 | +### Status codes explanation |
| 21 | + |
| 22 | +**200 OK** |
| 23 | + |
| 24 | +All the events are sent successfully. |
| 25 | + |
| 26 | +``` |
| 27 | +[ |
| 28 | + { |
| 29 | + "id": "9cdd0f68-df85-44b0-88bd-fc4163ac90a0", |
| 30 | + "status_code": 200, |
| 31 | + "result": "SUCCESS", |
| 32 | + "message": "Event sent successfully" |
| 33 | + }, |
| 34 | + { |
| 35 | + "id": "9cdd0f68-df85-44b0-88bd-fc4163ac90a1", |
| 36 | + "status_code": 200, |
| 37 | + "result": "SUCCESS", |
| 38 | + "message": "Event sent successfully" |
| 39 | + } |
| 40 | +] |
| 41 | +``` |
| 42 | + |
| 43 | +**207 Multi-Status** |
| 44 | + |
| 45 | +Events are having different internal status codes. |
| 46 | + |
| 47 | +``` |
| 48 | +[ |
| 49 | + { |
| 50 | + "id": "9cdd0f68-df85-44b0-88bd-fc4163ac90a0", |
| 51 | + "status_code": 200, |
| 52 | + "result": "SUCCESS", |
| 53 | + "message": "Event sent successfully" |
| 54 | + }, |
| 55 | + { |
| 56 | + "status_code": 400, |
| 57 | + "result": "Bad Request", |
| 58 | + "message": "Invalid event content, client need to fix problem in event before submitting again" |
| 59 | + } |
| 60 | +] |
| 61 | +``` |
| 62 | + |
| 63 | +**400 Bad Request** |
| 64 | + |
| 65 | +The input JSON is malformed. |
| 66 | + |
| 67 | +``` |
| 68 | +[ |
| 69 | + { |
| 70 | + "status_code": 400, |
| 71 | + "result": "Bad Request", |
| 72 | + "message": "Invalid event content, client need to fix problem in event before submitting again" |
| 73 | + } |
| 74 | +] |
| 75 | +``` |
| 76 | + |
| 77 | +**404 Not Found** |
| 78 | + |
| 79 | +RabbitMQ properties not configured in tomcat/conf/config.properties file for the protocol. |
| 80 | + |
| 81 | +``` |
| 82 | +[ |
| 83 | + { |
| 84 | + "status_code": 404, |
| 85 | + "result": "RabbitMQ properties not found", |
| 86 | + "message": "RabbitMQ properties not configured for the protocol <protocol>" |
| 87 | + } |
| 88 | +] |
| 89 | +``` |
| 90 | + |
| 91 | +**500 Internal Server Error** |
| 92 | + |
| 93 | +Cannot prepare routing key. |
| 94 | + |
| 95 | +``` |
| 96 | +[ |
| 97 | + { |
| 98 | + "status_code": 500, |
| 99 | + "result": "Internal Server Error", |
| 100 | + "message": "Could not prepare Routing key to publish message" |
| 101 | + } |
| 102 | +] |
| 103 | +``` |
| 104 | + |
| 105 | +Event is failed to send because of internal server error. |
| 106 | + |
| 107 | +``` |
| 108 | +[ |
| 109 | + { |
| 110 | + "id": "9cdd0f68-df85-44b0-88bd-fc4163ac90a0", |
| 111 | + "status_code": 500, |
| 112 | + "result": "Internal Server Error", |
| 113 | + "message": "RabbitMQ is down. Please try later" |
| 114 | + } |
| 115 | +] |
| 116 | +``` |
| 117 | + |
| 118 | +**503 Service Unavailable** |
| 119 | + |
| 120 | +Event will have this status code when the previous event is failed to send. |
| 121 | + |
| 122 | +For example, consider you have 5 events: **E1<-E2<-E3<-E4<-E5** |
| 123 | +You send them all to publish in a batch command. |
| 124 | +**E1** and **E2** are sent successfully **(200 OK)**. |
| 125 | +**E3** is malformed **(400 Bad Request)**. |
| 126 | +If we send **E4** and **E5** we will have a broken chain so that is not a good option. |
| 127 | +In this case we should skip sending **E4** and **E5** and have status code **503** for those. |
| 128 | + |
| 129 | +``` |
| 130 | +[ |
| 131 | + { |
| 132 | + "id": "9cdd0f68-df85-44b0-88bd-fc4163ac90a0", |
| 133 | + "status_code": 200, |
| 134 | + "result": "SUCCESS", |
| 135 | + "message": "Event sent successfully" |
| 136 | + }, |
| 137 | + { |
| 138 | + "id": "9cdd0f68-df85-44b0-88bd-fc4163ac90a1", |
| 139 | + "status_code": 200, |
| 140 | + "result": "SUCCESS", |
| 141 | + "message": "Event sent successfully" |
| 142 | + }, |
| 143 | + { |
| 144 | + "status_code": 400, |
| 145 | + "result": "Bad Request", |
| 146 | + "message": "Invalid event content, client need to fix problem in event before submitting again" |
| 147 | + }, |
| 148 | + { |
| 149 | + "status_code": 503, |
| 150 | + "result": "Service Unavailable", |
| 151 | + "message": "Please check previous event and try again later" |
| 152 | + }, |
| 153 | + { |
| 154 | + "status_code": 503, |
| 155 | + "result": "Service Unavailable", |
| 156 | + "message": "Please check previous event and try again later" |
| 157 | + } |
| 158 | +] |
| 159 | +``` |
| 160 | + |
| 161 | +**NOTE:** you can open the RabbitMQ's management console and find these messages in a queue. |
| 162 | + |
| 163 | +## Status codes related to failures in Eiffel REMReM Generate Service |
| 164 | + |
| 165 | +These response can be generated only when `/generateAndPublish` endpoint is used. |
| 166 | + |
| 167 | +| Status code | Result | Message | Comment | |
| 168 | +|-------------|-----------------------|-----------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------| |
| 169 | +| 400 | Bad Request | Malformed JSON or incorrect type of event | Is returned if the request body JSON is malformed or entered incorrect type of event. | |
| 170 | +| 401 | Unauthorized | Unauthorized. Please, check if LDAP for REMReM Generate Service is disabled | Is returned if LDAP for REMReM Generate Service is enabled and REMReM Generate Publish have not access to it. | |
| 171 | +| 406 | Not Acceptable | No event id found with ERLookup properties | Is returned if no event id fetched from configured event repository in REMReM generate. | |
| 172 | +| 417 | Expectation Failed | Multiple event ids found with ERLookup properties | Is returned if multiple event ids fetched from configured event repository in REMReM generate. | |
| 173 | +| 500 | Internal Server Error | Internal server error in Generate Service | Is returned if REMReM Generate Service is not started or in case of others internal errors in REMReM Generate Service. | |
| 174 | +| 503 | Service Unavailable | Message protocol is invalid | Is returned if there is no such message protocol loaded. | |
| 175 | + |
| 176 | +### Status codes explanation |
| 177 | + |
| 178 | +**400 Bad Request** |
| 179 | + |
| 180 | +The input JSON is malformed or entered incorrect type of event. |
| 181 | + |
| 182 | +``` |
| 183 | +[ |
| 184 | + { |
| 185 | + "status_code": 400, |
| 186 | + "result": "FAIL", |
| 187 | + "message": "Malformed JSON or incorrect type of event" |
| 188 | + } |
| 189 | +] |
| 190 | +``` |
| 191 | + |
| 192 | +**401 Unauthorized** |
| 193 | + |
| 194 | +LDAP for REMReM Generate Service is enabled and REMReM Generate Publish have not access to it. |
| 195 | + |
| 196 | +``` |
| 197 | +[ |
| 198 | + { |
| 199 | + "status_code": 401, |
| 200 | + "result": "FAIL", |
| 201 | + "message": "Unauthorized. Please, check if LDAP for REMReM Generate Service is disabled" |
| 202 | + } |
| 203 | +] |
| 204 | +``` |
| 205 | + |
| 206 | +**406 Not Acceptable** |
| 207 | + |
| 208 | +The Lookup properties with no event id fetched from configured event repository in generate , REMReM fails to generate. |
| 209 | + |
| 210 | +``` |
| 211 | +[ |
| 212 | + { |
| 213 | + "status_code": 406, |
| 214 | + "result": "FAIL", |
| 215 | + "message": "No event id found with ERLookup properties" |
| 216 | + } |
| 217 | +] |
| 218 | +``` |
| 219 | + |
| 220 | +**417 Expectation Failed** |
| 221 | +The Lookup properties with multiple event ids fetched from configured event repository in generate , REMReM fails to generate. |
| 222 | + |
| 223 | +``` |
| 224 | +[ |
| 225 | + { |
| 226 | + "status_code": 417, |
| 227 | + "result": "FAIL", |
| 228 | + "message": "Multiple event ids found with ERLookup properties" |
| 229 | + } |
| 230 | +] |
| 231 | +``` |
| 232 | + |
| 233 | +**500 Internal Server Error** |
| 234 | + |
| 235 | +REMReM Generate Service is not started or in case of others internal errors in REMReM Generate Service. |
| 236 | + |
| 237 | +``` |
| 238 | +[ |
| 239 | + { |
| 240 | + "status_code": 500, |
| 241 | + "result": "FAIL", |
| 242 | + "message": "Internal server error in Generate Service" |
| 243 | + } |
| 244 | +] |
| 245 | +``` |
| 246 | + |
| 247 | +**503 Service Unavailable** |
| 248 | + |
| 249 | +There is no such message protocol loaded.. |
| 250 | + |
| 251 | +``` |
| 252 | +[ |
| 253 | + { |
| 254 | + "status_code": 503, |
| 255 | + "result": "FAIL", |
| 256 | + "message": "Message protocol is invalid" |
| 257 | + } |
| 258 | +] |
| 259 | +``` |
0 commit comments