1
2
3
4
5
6
7
8
9
10
11 package org.mule.endpoint.inbound;
12
13 import org.mule.api.MuleEvent;
14 import org.mule.api.MuleException;
15 import org.mule.api.config.MuleProperties;
16 import org.mule.api.endpoint.InboundEndpoint;
17 import org.mule.api.processor.MessageProcessor;
18 import org.mule.api.transport.PropertyScope;
19 import org.mule.util.ObjectUtils;
20 import org.mule.util.StringUtils;
21
22
23
24
25
26
27 public class InboundEndpointPropertyMessageProcessor implements MessageProcessor
28 {
29 private InboundEndpoint endpoint;
30
31 public InboundEndpointPropertyMessageProcessor(InboundEndpoint endpoint)
32 {
33 this.endpoint = endpoint;
34 }
35
36 public MuleEvent process(MuleEvent event) throws MuleException
37 {
38
39 String inboundEndpoint = endpoint.getName();
40
41 if (StringUtils.isBlank(inboundEndpoint))
42 {
43
44 inboundEndpoint = endpoint.getEndpointURI().getUri().toString();
45 }
46 event.getMessage().setProperty(MuleProperties.MULE_ORIGINATING_ENDPOINT_PROPERTY, inboundEndpoint, PropertyScope.INBOUND);
47 return event;
48 }
49
50 @Override
51 public String toString()
52 {
53 return ObjectUtils.toString(this);
54 }
55 }