| 530 |
jeje |
1 |
/**
|
| 182 |
jeje |
2 |
* Elastic Grid
|
| 530 |
jeje |
3 |
* Copyright (C) 2008-2010 Elastic Grid, LLC.
|
|
|
4 |
*
|
| 182 |
jeje |
5 |
* This program is free software: you can redistribute it and/or modify
|
|
|
6 |
* it under the terms of the GNU Affero General Public License as
|
| 55 |
jeje |
7 |
* published by the Free Software Foundation, either version 3 of the
|
| 182 |
jeje |
8 |
* License, or (at your option) any later version.
|
| 530 |
jeje |
9 |
*
|
| 182 |
jeje |
10 |
* This program is distributed in the hope that it will be useful,
|
| 55 |
jeje |
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 182 |
jeje |
13 |
* GNU Affero General Public License for more details.
|
| 530 |
jeje |
14 |
*
|
| 182 |
jeje |
15 |
* You should have received a copy of the GNU Affero General Public License
|
| 530 |
jeje |
16 |
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
17 |
*/
|
| 2 |
jeje |
18 |
package com.elasticgrid.amazon.sqs;
|
|
|
19 |
|
|
|
20 |
import org.rioproject.event.EventDescriptor;
|
| 42 |
jeje |
21 |
import org.rioproject.event.RemoteServiceEvent;
|
| 2 |
jeje |
22 |
import java.io.Serializable;
|
|
|
23 |
|
|
|
24 |
/**
|
|
|
25 |
* @author Jerome Bernard
|
|
|
26 |
*/
|
|
|
27 |
public class SQSEvent extends RemoteServiceEvent implements Serializable {
|
|
|
28 |
/** A unique id number for the hello event **/
|
|
|
29 |
public static final long ID = 9999999999L;
|
|
|
30 |
/** Holds the property for the time the event was created */
|
|
|
31 |
private long when;
|
|
|
32 |
/** Holds the message ID property */
|
|
|
33 |
private String messageID;
|
|
|
34 |
/** Holds the message ID property */
|
|
|
35 |
private String messageReceiptHandle;
|
|
|
36 |
/** Holds the message ID property */
|
|
|
37 |
private String messageBody;
|
|
|
38 |
/** Holds the message ID property */
|
|
|
39 |
private String messageBodyMD5;
|
|
|
40 |
|
|
|
41 |
public SQSEvent(Object source) {
|
|
|
42 |
this(source, null, null, null, null);
|
|
|
43 |
}
|
|
|
44 |
|
|
|
45 |
public SQSEvent(Object source, String messageID, String messageReceiptHandle, String messageBody, String messageBodyMD5) {
|
|
|
46 |
super(source);
|
|
|
47 |
this.messageID = messageID;
|
|
|
48 |
this.messageReceiptHandle = messageReceiptHandle;
|
|
|
49 |
this.messageBody = messageBody;
|
|
|
50 |
this.messageBodyMD5 = messageBodyMD5;
|
|
|
51 |
when = System.currentTimeMillis();
|
|
|
52 |
}
|
|
|
53 |
|
|
|
54 |
public long getWhen() {
|
|
|
55 |
return when;
|
|
|
56 |
}
|
|
|
57 |
|
|
|
58 |
public String getMessageID() {
|
|
|
59 |
return messageID;
|
|
|
60 |
}
|
|
|
61 |
|
|
|
62 |
public String getMessageReceiptHandle() {
|
|
|
63 |
return messageReceiptHandle;
|
|
|
64 |
}
|
|
|
65 |
|
|
|
66 |
public String getMessageBody() {
|
|
|
67 |
return messageBody;
|
|
|
68 |
}
|
|
|
69 |
|
|
|
70 |
public String getMessageBodyMD5() {
|
|
|
71 |
return messageBodyMD5;
|
|
|
72 |
}
|
|
|
73 |
|
|
|
74 |
public static EventDescriptor getEventDescriptor() {
|
|
|
75 |
return (new EventDescriptor(SQSEvent.class, ID));
|
|
|
76 |
}
|
|
|
77 |
|
|
|
78 |
public String toString() {
|
|
|
79 |
return "SQSEvent{" +
|
|
|
80 |
"when=" + when +
|
|
|
81 |
", messageID='" + messageID + '\'' +
|
|
|
82 |
", messageReceiptHandle='" + messageReceiptHandle + '\'' +
|
|
|
83 |
", messageBody='" + messageBody + '\'' +
|
|
|
84 |
", messageBodyMD5='" + messageBodyMD5 + '\'' +
|
|
|
85 |
'}';
|
|
|
86 |
}
|
|
|
87 |
}
|