How do you configure an HTTP Listener in Mule 4?
Suggested answer
The HTTP Listener triggers a Mule flow when an HTTP request is received. Configuration:
1. Connector Configuration: Defines host (0.0.0.0 for all interfaces or specific IP) and port (e.g., 8081). Protocol: HTTP or HTTPS (HTTPS requires a TLS context with keystore). Reused across multiple Listener instances.
2. Path: The URL path this listener responds to (e.g., /api/orders or /api/orders/{orderId} with URI parameters).
3. Allowed Methods: Optionally restrict to GET, POST, PUT, PATCH, DELETE.
4. Response: Configure default response body, status code
5. , and response headers in the Listener's response section. URI parameters: accessible via attributes.uriParams.orderId. Query parameters: attributes.queryParams.pageSize. Request body: payload. base path can be set at the connector config level for a common prefix.
Practice content for interview preparation; not an official vendor answer. Verify details against current product documentation.
Community comments (0)
No comments yet.
Sign in or create a free account to add a comment. Comments are moderated before they appear.