/**
* Enumeration for the message delivery mode. Can be persistent or
* non persistent. Use the method 'toInt' to get the appropriate value
* that is used the he AMQP protocol instead of the ordinal() value when
* passing into AMQP APIs.
*
* @author Mark Pollack
* @author Gary Russell
*
*/
public enum MessageDeliveryMode { NON_PERSISTENT, PERSISTENT; public static int toInt(MessageDeliveryMode mode) {
switch (mode) {
case NON_PERSISTENT:
return 1;
case PERSISTENT:
return 2;
default:
return -1;
}
} public static MessageDeliveryMode fromInt(int modeAsNumber) {
switch (modeAsNumber) {
case 1:
return NON_PERSISTENT;
case 2:
return PERSISTENT;
default:
return null;
}
} }
05-08 08:24