1 10 11 package org.mule.routing.inbound; 12 13 import org.mule.MuleManager; 14 import org.mule.impl.ImmutableMuleEndpoint; 15 import org.mule.umo.MessagingException; 16 import org.mule.umo.UMOEvent; 17 import org.mule.umo.UMOException; 18 import org.mule.umo.endpoint.UMOImmutableEndpoint; 19 20 29 public class WireTap extends SelectiveConsumer 30 { 31 private String endpoint; 32 33 private UMOImmutableEndpoint tap; 34 35 public boolean isMatch(UMOEvent event) throws MessagingException 36 { 37 if (endpoint != null) 38 { 39 return super.isMatch(event); 40 } 41 else 42 { 43 logger.warn("No endpoint identifier is set on this wire tap"); 44 return false; 45 } 46 } 47 48 public UMOEvent[] process(UMOEvent event) throws MessagingException 49 { 50 51 try 52 { 53 event.getSession().dispatchEvent(event.getMessage(), tap); 54 } 55 catch (UMOException e) 56 { 57 logger.error(e.getMessage(), e); 58 } 59 return super.process(event); 60 } 61 62 public String getEndpoint() 63 { 64 return endpoint; 65 } 66 67 public void setEndpoint(String endpoint) throws UMOException 68 { 69 this.endpoint = endpoint; 70 if (this.endpoint != null) 71 { 72 tap = MuleManager.getInstance().lookupEndpoint(this.endpoint); 73 if (tap == null) 74 { 75 tap = new ImmutableMuleEndpoint(this.endpoint, false); 76 } 77 } 78 } 79 } 80 | Popular Tags |