Changeset 67
- Timestamp:
- 06/27/13 11:44:54 (11 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 1 deleted
- 3 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/main/java/omq/server/RemoteObject.java
r66 r67 93 93 this.broker = broker; 94 94 UID = reference; 95 serializer = broker.getSerializer(); 95 96 if (channel == null || !channel.isOpen()) { 96 97 channel = broker.getChannel(); … … 142 143 @Override 143 144 public void notifyEvent(Event event) throws IOException, SerializerException { 145 String corrID = java.util.UUID.randomUUID().toString(); 144 146 event.setTopic(UID); 147 event.setCorrId(corrID); 145 148 EventWrapper wrapper = new EventWrapper(event); 146 149 channel.exchangeDeclare(UID, "fanout"); 147 150 channel.basicPublish(UID, "", null, serializer.serialize(wrapper)); 151 logger.debug("Sending event-> topic: " + UID + ", corrID: " + corrID); 148 152 } 149 153 -
trunk/src/test/java/omq/test/event/EventTrigger.java
r66 r67 1 1 package omq.test.event; 2 2 3 import java.io.IOException; 4 3 5 import omq.Remote; 6 import omq.client.annotation.AsyncMethod; 4 7 import omq.client.annotation.RemoteInterface; 8 import omq.exception.SerializerException; 5 9 6 10 @RemoteInterface 7 11 public interface EventTrigger extends Remote { 8 12 @AsyncMethod 13 public void triggerEvent(String message) throws IOException, SerializerException; 9 14 } -
trunk/src/test/java/omq/test/event/EventTriggerImpl.java
r66 r67 1 1 package omq.test.event; 2 2 3 import java.io.IOException; 4 5 import omq.exception.SerializerException; 3 6 import omq.server.RemoteObject; 4 7 … … 9 12 */ 10 13 private static final long serialVersionUID = 1L; 14 15 public void triggerEvent(String message) throws IOException, SerializerException { 16 MessageEvent event = new MessageEvent(message); 17 this.notifyEvent(event); 18 } 11 19 12 20 } -
trunk/src/test/java/omq/test/event/MessageEvent.java
r66 r67 3 3 import omq.common.event.Event; 4 4 5 public class ZeroEvent extends Event {5 public class MessageEvent extends Event { 6 6 /** 7 7 * … … 9 9 private static final long serialVersionUID = 1L; 10 10 11 public ZeroEvent() { 11 private String message; 12 13 public MessageEvent() { 12 14 } 13 15 14 public ZeroEvent(String corrId, String topic) {15 super(corrId, topic);16 public MessageEvent(String message) { 17 this.message = message; 16 18 } 17 19 18 public String getZeroMessage() { 19 return "divition by 0"; 20 public String getMessage() { 21 return message; 22 } 23 24 public void setMessage(String message) { 25 this.message = message; 20 26 } 21 27 -
trunk/src/test/java/omq/test/event/MessageListener.java
r66 r67 3 3 import omq.common.event.EventListener; 4 4 5 public class ZeroListener extends EventListener<ZeroEvent> { 5 public class MessageListener extends EventListener<MessageEvent> { 6 private String message; 6 7 7 public ZeroListener(String topic) { 8 super(topic); 8 @Override 9 public void notifyEvent(MessageEvent event) { 10 message = event.getMessage(); 9 11 } 10 12 11 @Override 12 public void notifyEvent(ZeroEvent event) { 13 System.out.println(event.getZeroMessage()); 13 public String getMessage() { 14 return message; 15 } 16 17 public void setMessage(String message) { 18 this.message = message; 14 19 } 15 20 }
Note: See TracChangeset
for help on using the changeset viewer.