Martini Generating Services when Consuming AsyncAPI APIs
Martini's graphical interface streamlines the creation of services from AsyncAPI schemas, facilitating quick integration with AsyncAPI APIs. Follow these steps to generate services in Martini from a AsyncAPI schema.
Importing an AsyncAPI Schema
-
Navigate to the Consume API Interface: In Martini, open the Navigator view.
-
Start the Consume API Wizard: Right-click on your target package and select “New | Consume API” from the context menu to launch the Consume an API wizard.
-
Complete the Required Values:
-
Location: Browse to the directory within your package where you would like your generated services saved.
- Source: Select AsyncAPI
-
File/URL: Provide the file path or enter the URL for the AsyncAPI schema.
-
Optional Settings: To track events in the Tracker Transaction log, check "Log requests to Tracker." Note that logging to the Tracker may add overhead and consume additional database resources.
-
Complete the Import: Click “Consume” to generate services from the AsyncAPI API specification. Martini will generate a service for each operation defined in the API specification, saving them to the specified directory.
Post-Generation Steps
After generating the services, you may need to take additional steps:
- Customize Generated Services: Review the autogenerated service components and customize queries, mutations, or subscriptions as needed to suit your business logic.
- Test Services: Invoke the generated services and ensure they interact with the AsyncAPI API as expected.
- Secure the Services: If your AsyncAPI API requires authentication, ensure that the necessary headers or tokens are configured in the authentication service inputs.