Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
RetryContext |
|
| 0.0;0 |
1 | /* | |
2 | * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com | |
3 | * The software in this package is published under the terms of the CPAL v1.0 | |
4 | * license, a copy of which has been included with this distribution in the | |
5 | * LICENSE.txt file. | |
6 | */ | |
7 | package org.mule.api.retry; | |
8 | ||
9 | import org.mule.api.MuleContext; | |
10 | import org.mule.api.MuleMessage; | |
11 | ||
12 | import java.util.Map; | |
13 | ||
14 | /** | |
15 | * The RetryContext is used to store any data which carries over from | |
16 | * attempt to attempt such as response messages. | |
17 | */ | |
18 | public interface RetryContext | |
19 | { | |
20 | String FAILED_RECEIVER = "failedReceiver"; | |
21 | String FAILED_DISPATCHER = "failedDispatcher"; | |
22 | String FAILED_REQUESTER = "failedRequester"; | |
23 | ||
24 | /** | |
25 | * @return a read-only meta-info map or an empty map, never null. | |
26 | */ | |
27 | Map<Object, Object> getMetaInfo(); | |
28 | ||
29 | MuleMessage[] getReturnMessages(); | |
30 | ||
31 | MuleMessage getFirstReturnMessage(); | |
32 | ||
33 | void setReturnMessages(MuleMessage[] returnMessages); | |
34 | ||
35 | void addReturnMessage(MuleMessage result); | |
36 | ||
37 | String getDescription(); | |
38 | ||
39 | MuleContext getMuleContext(); | |
40 | ||
41 | /** | |
42 | * The most recent failure which prevented the context from validating the connection. Note that the method may | |
43 | * return null. Instead, the {@link #isOk()} should be consulted first. | |
44 | * | |
45 | * @return last failure or null | |
46 | */ | |
47 | Throwable getLastFailure(); | |
48 | ||
49 | /** | |
50 | * Typically called by validation logic to mark no problems with the current connection. Additionally, | |
51 | * clears any previous failure set. | |
52 | */ | |
53 | void setOk(); | |
54 | ||
55 | /** | |
56 | * Typically called by validation logic to mark a problem and an optional root cause. | |
57 | * | |
58 | * @param lastFailure the most recent failure, can be null | |
59 | */ | |
60 | void setFailed(Throwable lastFailure); | |
61 | ||
62 | /** | |
63 | * Note that it's possible for an implementation to return false and have no failure specified, thus | |
64 | * the subsequent {@link #getLastFailure()} may return null. | |
65 | * | |
66 | * @return true if no problems detected before | |
67 | */ | |
68 | boolean isOk(); | |
69 | } |