Free MuleSoft CONNECT Keynote & Expo Pass Available!

Register now+
Nav

Defining Parameters in a Message Source

Parameters are defined as fields of your Source class. All the features and annotations (such as @NullSafe, @ParameterGroup, @TypeResolver) are available when defining an operation, for example:


         
      
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
@EmitsResponse
public class HttpListener extends Source<InputStream, HttpRequestAttributes> {

    @Config
    private HttpListenerConfig config;

    @Parameter
    @Optional(defaultValue = "/")
    private String path;

    @Parameter
    private Integer port;

    /**
    * Comma separated list of allowed HTTP methods by this listener.
    */
    @Parameter
    @Optional
    @Placement(tab = Placement.ADVANCED_TAB)
    @Summary("Comma separated list of methods. Leave empty to allow all.")
    @Example("GET, POST")
    private String allowedMethods;
}

This is similar to how configs are defined, except that none of these parameters accept expressions. Using the @Expression annotation to support or require expression support will result in an error.

In this topic: