/
NodeState.java
78 lines (66 loc) · 2.36 KB
/
NodeState.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
package org.openhubframework.openhub.api.entity;
import org.apache.commons.lang3.builder.ToStringBuilder;
/**
* Contains all states for {@link Node}
*
* @author Roman Havlicek
* @see Node#state
* @since 2.0.0
*/
public enum NodeState {
/**
* Node process new and existing (saved messages in ESB) messages.
*/
RUN(true, true),
/**
* Node process only existing messages. New messages/requests are rejected.
*/
PROCESS_EXISTING_MESSAGES(false, true),
/**
* Node not process existing messages and new messages.
*/
STOPPED(false, false);
/**
* {@code true} node process new incoming messages, {@code false} - otherwise.
*/
private final boolean processNewMessages;
/**
* {@code true} node process existing saved messages, {@code false} - otherwise.
*/
private final boolean processExistingMessages;
/**
* New instance.
*
* @param processNewMessages @code true} node process new incoming messages, {@code false} - otherwise
* @param processExistingMessages {@code true} node process existing saved messages, {@code false} - otherwise
*/
NodeState(boolean processNewMessages, boolean processExistingMessages) {
this.processNewMessages = processNewMessages;
this.processExistingMessages = processExistingMessages;
}
/**
* Gets if {@link Node} in this state process new incoming messages.
*
* @return {@code true} node process new incoming messages, {@code false} - oterwise
*/
public boolean isProcessNewMessages() {
return processNewMessages;
}
/**
* Gets if {@link Node} in this state process messages existing saved in ESB (from SEDA or
* {@link MsgStateEnum#PARTLY_FAILED}, {@link MsgStateEnum#POSTPONED}, etc.).
*
* @return {@code true} node process existing saved messages, {@code false} - otherwise
*/
public boolean isProcessExistingMessages() {
return processExistingMessages;
}
//--------------------------------------------- TOSTRING / HASH / EQUALS -------------------------------------------
@Override
public String toString() {
return new ToStringBuilder(this)
.append("processNewMessages", processNewMessages)
.append("processExistingMessages", processExistingMessages)
.toString();
}
}