Contact Free trial Login

Context Information Injection

To get information about the context in which an operation or source is being processed, you can add parameters to the operation or source. The parameters do not appear in the UI, but they are injected by the SDK into the runtime.

Component Location

When executing an operation or using a source, you might want to have some context about the location of the component, mostly for logging purposes. To achieve this, you can define a ComponentLocation as a parameter, and it will be injected.

This examples shows how to log the component location when starting a source:

public class HttpListener extends Source<InputStream, HttpRequestAttributes> {

  private static final Logger LOGGER = getLogger(HttpListener.class);

  private ConnectionProvider<HttpServer> serverProvider;

  private ComponentLocation location;

  private String path;

  private HttpServer server;

  public void onStart(SourceCallback<InputStream, HttpRequestAttributes> sourceCallback) throws MuleException {
    server = serverProvider.connect();
    if (LOGGER.isDebugEnabled()) {
      LOGGER.debug("Starting HTTP Listener %s on path %s", location.getLocation(), path);
// ...

We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used and to tailor advertising. You can read more and make your cookie choices here. By continuing to use this site you are giving us your consent to do this.