APIkit for AsyncAPI Module Reference | MuleSoft Documentation
# APIkit for AsyncAPI Module Reference
To collaborate, build applications, and maintain codebases, learn the fundamentals of dependency, namespace, and schema information in APIkit for AsyncAPI.
## Dependencies
```
<dependency>
 <groupId>org.mule.modules</groupId>
 <artifactId>mule-asynckit-module</artifactId>
 <version>LATEST_VERSION</version> **(1)**
 <classifier>mule-plugin</classifier>
</dependency>
```

Check the APIkit Release Notes to get the **LATEST_VERSION**.  
---  
## Namespace and Schema
```
xmlns:apikit-asyncapi="http://www.mulesoft.org/schema/mule/apikit-asyncapi"
xsi:schemaLocation="http://www.mulesoft.org/schema/mule/apikit-asyncapi http://www.mulesoft.org/schema/mule/apikit-asyncapi/current/mule-apikit-asyncapi.xsd">
```

## Configurations
### Config
Default configuration
#### Parameters
Name | Type | Description | Default Value | Required  
---|---|---|---|---  
Name for this configuration. Connectors reference the configuration with this name.  
Api Definition | API definition.  
Disable Content Validation | Disable payload content validation.  
Kafka Configs | Array of Kafka Config | List of Kafka server configurations. One for each Kafka server listed in the specification that is scaffolded to create the app.  
Anypoint MQ Configs | Array of Anypoint MQ Config | List of AMQ configurations.  
Solace Configs | Array of Solace Config | List of Solace configurations.  
Salesforce Pub/Sub Configs | Array of Salesforce Pub/Sub Connector Config | List of SalesforcePubSub configurations.  
Identifier of this element used to reference it in other components.  
### Supported Message Brokers
Message Broker | Description | Supported Protocols | Configuration Details  
---|---|---|---  
Anypoint MQ | Supports asynchronous messaging with Anypoint MQ. | anypointmq | Anypoint MQ configurations are specified in the server object of the AsyncAPI specification. Supports **Message Listener** and **Subscribe** operations.  
Supports asynchronous messaging with Apache Kafka. | kafka, kafka-secure | Kafka configurations are specified in the server object of the AsyncAPI specification. Supports **Message Listener** and **Subscribe** operations.  
Salesforce platform events | Allows implementing an Async API specification using Anypoint Connector for Salesforce Pub/Sub (Salesforce Pub/Sub Connector). | salesforcepubsub* | Connection details are available in the properties file. Supports **Message Listener** and **Subscribe** operations, and **Message Listener** and **Publish** operations. In the **Message Listener** operation, the AsyncAPI spec `defaultContentType` must be application/JSON. In the **Publish** operation, the payload must be JSON. The APIkit for AsyncAPI module transforms the JSON payload to the array-of-objects type.  
Solace Pub/Sub+ | Supports the implementation of an Async API specification using Solace PubSub+ Connector. | Connection details are available in the properties file. Supports **Message Listener** and **Publish** operations.  
* You must use Anypoint Connector for Salesforce Pub/Sub Connector 1.0.15 or later.
#### Associated Operations
#### Associated Sources
  * Message Listener


## Validation of Messages
Unless explicitly restricted, the JSON schema validation allows omitting and adding fields. Check the message validation against the schema in the following table:
Schema Definition | Message | Valid  
---|---|---  
{ A: integer, B: string }  
{ A: integer, B: string }  
{ A: integer, B: string } required [A, B]  
{ A: integer, B: string } required [A, B] | {A, B, C}  
{ A: integer, B: string } required [A, B] `additionalProperties` = `false` | {A, B, C}  
{ A: integer, B: string } required [A, B] `additionalProperties` = `false`  
  * The `required` field specifies the list of fields that are mandatory in the JSON object.
  * The `additionalProperties` field specifies if you can include additional properties to the JSON object.


The schemas must specify `required` and `additionalProperties` in the API specification.
The field value is checked against the type specified in the schema as part of the validation.   
---  
If an operation has multiple message schemas associated in the specification, the validation adheres to these principles:
  * Messages are validated against every schema.
  * If it’s compliant with at least one schema, the message is considered valid.
  * If the message doesn’t adhere to at least one schema, the message is considered invalid.


### Example
Schema Definition | Message | Valid  
---|---|---  
{ A: integer, B: string } required [A, B] `additionalProperties` = `false` { C: integer, D: string } required [C, D] `additionalProperties` = `false`  
{ A: integer, B: string } required [A, B] `additionalProperties` = `false` { C: integer, D: string } required [C, D] `additionalProperties` = `false`  
{ A: integer, B: string } required [A, B] `additionalProperties` = `false` { C: integer, D: string } required [C, D] `additionalProperties` = `false` | {A, B, C}  
{ A: integer, B: string } required [A, B] `additionalProperties` = `false` { C: integer, D: string } required [C, D] `additionalProperties` = `false`  
## Publish
`<apikit-asyncapi:publish>`
### Parameters
Name | Type | Description | Default Value | Required  
---|---|---|---|---  
Configuration | Name of the configuration to use  
The binary content to be processed | #[payload]  
Disable Content Validation | Indicates if validation of the content is disabled  
Config Ref | ConfigurationProvider | Name of the configuration used to execute this component  
Channel Name | Channel name  
Server Name | Server name  
Target Variable | Name of a variable in which the operation output is placed  
Target Value | Expression that is evaluated against the operation output and the result of that expression is stored in the target variable | #[payload]  
Error Mappings | Array of Error Mapping | Set of error mappings  
### Output
Field | Description  
---|---  
Publish Response  
### For Configurations
### Throws
  * APIKIT-ASYNCAPI:INTERNAL_SERVER_ERROR
  * APIKIT-ASYNCAPI:PUBLISHING_ERROR
  * APIKIT-ASYNCAPI:VALIDATION_ERROR


## Message Listener
`<apikit-asyncapi:message-listener>`
### Parameters
Name | Type | Description | Default Value | Required  
---|---|---|---|---  
Configuration | Name of the configuration to use  
Disable Content Validation | Disable payload content validation  
Channel Name | Channel name  
Array of String | List of servers to listen to  
Output MIME Type | MIME type of the payload that this operation generates  
Output Encoding | Encoding of the payload that this operation generates  
Primary Node Only | Specifies if this source must be executed on the primary node when running in a cluster  
Config Ref | ConfigurationProvider | Name of the configuration used to execute this component  
Streaming Strategy | 
  * Repeatable In Memory Stream
  * Repeatable File Store Stream
  * non-repeatable-stream

| Specify and configure repeatable streams  
Redelivery Policy | Redelivery Policy | Policy for processing the redelivery of the same message  
### Output
Field | Description  
---|---  
Attributes Type |  One of:
  * Kafka Message Attributes
  * Anypoint MQ Message Attributes
  * Solace Message Attributes
  * Salesforce Pub/Sub Attributes

  
### For Configurations
## Types
### Kafka Config
Field | Type | Description | Default Value | Required  
---|---|---|---|---  
Server Key | Identifier for the server configuration within the AsyncAPI configuration  
Producer Config Ref | Reference to the Kafka Producer configuration  
Consumer Config Ref | Reference to the Kafka Consumer configuration  
The Server Key is required to uniquely identify the server configuration. The references for Producer and Consumer configurations are optional and depend on the specific setup and requirements of the Kafka implementation.   
---  
### Anypoint MQ Config
Field | Type | Description | Default Value | Required  
---|---|---|---|---  
Server Key | Identifier for the server configuration in AsyncAPI  
Config Ref | Reference to the Anypoint MQ configuration details  
The Server Key is required to uniquely identify the server configuration. Config Ref is optional and used to specify additional configuration details.   
---  
### Solace Config
Field | Type | Description | Default Value | Required  
---|---|---|---|---  
Server Key | Server key set in the AsyncAPI spec  
Config Ref | Reference to the configuration name of the Solace connection  
The Server Key is required to uniquely identify the server configuration. Config Ref is optional and used to specify additional configuration details.   
---  
### Limitations of Solace PubSub+ Connector
Solace PubSub+ Connector in APIkit for AsyncAPI has these limitations:
  * The Solace PubSub+ Connector supports `queue` and `topic` for `destinations` in the **message listener** and **publish** operations. But the APIkit for AsyncAPI implementation only supports using `queue` as the value of `destination`.
  * Only one operator of the same type must be mapped to the same `queue` of `destination`.
### Salesforce Pub/Sub Connector Config
Field | Type | Description | Default Value | Required  
---|---|---|---|---  
Server Key | Server key set in the AsyncAPI spec  
Config Ref | Reference to the name of the Salesforce Pub/Sub Connector configuration  
The Server Key is required to uniquely identify the server configuration. Config Ref is optional and used to specify additional configuration details.   
---  
### Repeatable In Memory Stream
Field | Type | Description | Default Value | Required  
---|---|---|---|---  
Initial Buffer Size | Amount of memory allocated to consume the stream and provide random access to it. If the stream data is larger than the buffer capacity, it expands according to the `bufferSizeIncrement` attribute, with an upper limit of `maxInMemorySize`.  
Buffer Size Increment | How much the buffer size expands if it exceeds its initial size. A value of zero or lower specifies that the buffer doesn’t expand. When the buffer is full, a `STREAM_MAXIMUM_SIZE_EXCEEDED` error occurs.  
Max Buffer Size | Maximum amount of memory used. If more is used, a `STREAM_MAXIMUM_SIZE_EXCEEDED` error is raised. A value lower or equal to zero means no limit.  
Buffer Unit |  Enumeration, one of: | These attributes are expressed in this unit.  
### Repeatable File Store Stream
Field | Type | Description | Default Value | Required  
---|---|---|---|---  
In Memory Size | Defines the maximum memory that the stream uses to keep data in memory. If it consumes more, the stream buffers the content on the disk.  
Buffer Unit |  Enumeration, one of: | The unit for expressing `maxInMemorySiz`.  
### Redelivery Policy
Field | Type | Description | Default Value | Required  
---|---|---|---|---  
Max Redelivery Count | Maximum number of times a message can be redelivered and processed unsuccessfully before triggering process-failed-message  
Message Digest Algorithm | Secure hashing algorithm  
Message Identifier | Redelivery Policy Message Identifier | Strategy used to identify the messages  
Object Store | ObjectStore | Object store where the redelivery counter for each message is stored  
### Redelivery Policy Message Identifier
Field | Type | Description | Default Value | Required  
---|---|---|---|---  
Use Secure Hash | Whether to use a secure hash algorithm to identify a redelivered message.  
Id Expression | Expression used to determine if a message has been redelivered. You can set this property if `useSecureHash` is `false`.  
### Publish Response
Field | Type | Description | Default Value | Required  
---|---|---|---|---  
Response Data | Data the server returns in response to a request  
### Error Mapping
Field | Type | Description | Default Value | Required  
---|---|---|---|---  
Enumeration, one of:
  * REDELIVERY_EXHAUSTED
  * TRANSFORMATION
  * EXPRESSION
  * SECURITY
  * CLIENT_SECURITY
  * SERVER_SECURITY
  * ROUTING
  * CONNECTIVITY
  * RETRY_EXHAUSTED
  * TIMEOUT

| Type of error encountered during the operation  
The specific component or module where the error needs to be addressed  
### Kafka Message Attributes
Field | Type | Description | Default Value | Required  
---|---|---|---|---  
Channel Name | Name of the Kafka channel (topic) where the message is published or consumed  
Channel Parameters | Additional parameters or settings specific to the channel  
Creation Timestamp | DateTime | Timestamp when the message was created  
Metadata associated with the message, typically key-value pairs  
This key determines the partition within the Kafka topic where the message is sent  
Leader Epoch | Epoch of the leader broker at the time the message is sent  
Log Append Timestamp | DateTime | Timestamp when the message is appended to the log  
Message offset in the Kafka topic partition  
Partition | Partition within the Kafka topic where the message is stored  
Protocol | Protocol the Kafka server uses  
Server Name | Name of the Kafka server that processes the message  
### Anypoint MQ Message Attributes
Field | Type | Description | Default Value | Required  
---|---|---|---|---  
Ack Token | Token used for acknowledging the receipt of a message  
Channel Name | Name of the Anypoint MQ channel where the message is published or consumed  
Channel Parameters | Additional parameters or settings specific to the channel  
Content Type | MIME type of the message content  
Delivery Count | Number of times the message is delivered  
Metadata associated with the message, typically key-value pairs  
Message Id | Unique identifier for the message  
Properties | Custom properties associated with the message  
Protocol | Protocol the Anypoint MQ server uses  
Server Name | Name of the Anypoint MQ server that processes the message  
### Solace Message Attributes
Field | Type | Description | Default Value | Required  
---|---|---|---|---  
DMQ Eligible | Indicates if the message is eligible for Dead Message Queue  
Channel Name | Name of the Solace channel where the message is published or consumed  
Channel Parameters | Additional parameters or settings specific to the Solace channel  
Content Type | MIME type of the message content  
Delivery Mode | Delivery mode of the message  
Discard Indication | Indicates if the message is discarded  
Eliding Eligible | Indicates if the message is eligible for eliding  
Endpoint Type | Type of endpoint used  
Message Reference Id | Reference identifier for the message  
Priority | Priority level of the message  
Protocol | Protocol the Solace server uses  
Receive Timestamp | DateTime | Timestamp when the message was received  
Redelivered | Indicates if the message is redelivered  
Indicates if the message expects a reply  
Server Name | Name of the Solace server that processes the message  
Time To Live | Time in milliseconds that the message remains valid  
### Salesforce Pub/Sub Attributes
Field | Type | Description | Default Value | Required  
---|---|---|---|---  
Channel Name | Name of the Salesforce Pub/Sub channel where the message is published or consumed  
Channel Parameters | Additional parameters or settings specific to the Salesforce Pub/Sub channel  
Protocol | Protocol the Salesforce Pub/Sub server uses  
Server Name | Name of the Salesforce Pub/Sub server that processes the message