1
2
3
4
5
6
7 package org.mule.context.notification;
8
9 import org.mule.api.context.notification.BlockingServerEvent;
10 import org.mule.api.context.notification.ServerNotification;
11 import org.mule.api.transaction.Transaction;
12
13 public class TransactionNotification extends ServerNotification implements BlockingServerEvent
14 {
15
16
17
18 private static final long serialVersionUID = -3245036187011582121L;
19 public static final int TRANSACTION_BEGAN = TRANSACTION_EVENT_ACTION_START_RANGE + 1;
20 public static final int TRANSACTION_COMMITTED = TRANSACTION_EVENT_ACTION_START_RANGE + 2;
21 public static final int TRANSACTION_ROLLEDBACK = TRANSACTION_EVENT_ACTION_START_RANGE + 3;
22
23 static
24 {
25 registerAction("begin", TRANSACTION_BEGAN);
26 registerAction("commit", TRANSACTION_COMMITTED);
27 registerAction("rollback", TRANSACTION_ROLLEDBACK);
28 }
29
30
31
32
33
34 private String transactionStringId;
35
36 public TransactionNotification(Transaction transaction, int action)
37 {
38 super(transaction.getId(), action, transaction.getId());
39 this.transactionStringId = transaction.getId();
40 }
41
42 public String getTransactionStringId()
43 {
44 return this.transactionStringId;
45 }
46
47 @Override
48 public String toString()
49 {
50 return EVENT_NAME + "{" + "action=" + getActionName(action) + ", transactionStringId=" + transactionStringId
51 + ", timestamp=" + timestamp + "}";
52 }
53
54 }