Reuse is not a new buzzword in the industry. Reuse that’s driven by API-led connectivity has accelerated project development, time-to-market, and improved the overall business and customer experience.
But, is reuse limited to APIs? The answer is no.
Enabling reusability requires a shift in mindset. In this blog post, I’ll review some of the alternate ways to drive reusability, outside of APIs. Here are the five elements we’ll discuss:
- RAML fragments
- Custom policies
#1 RAML fragments
In RAML design, a common best practice is to break the main RAML code into the appropriate types of fragments (Datatype, resource type, libraries, etc.). This creates an opportunity to create reusable fragments based on the domain object, error types, response codes, and so on. This way of designing RAML projects accelerates design, creates consistency, and enforces defined standards. Learn more about API fragments reuse.
DataWeave is MuleSoft’s expression language that allows you to access and transform data passing through a Mule app. With DataWeave2.0, you can create reusable modules for specific projects or create a .dwl file as a jar that contains common DataWeave modules and import them as a dependency in any project — speeding up development efforts. Learn more about how to reuse DataWeave code.
MuleSoft provides thousands of out-of-the-box connectors that accelerate development. Leveraging a reusable connector adds ease and accelerates the development of commonly used functions such as alerting, log formatting, or performing business-specific custom logic. MuleSoft provides various ways to create customer connectors.
#4 Custom policies
Custom policies in MuleSoft can be applied at the API gateway to manage, secure, control traffic, and improve API adoption. There are many policies available out of the box. Some organizations have unique requirements for security or log tracing but shouldn’t resort to creating custom code in each Mule API or app they build. You can define and create custom policies in MuleSoft that can be applied across APIs. This way of reuse makes development easier and brings enforcement of common custom policies at the API gateway. Learn more about creating a custom policy.
When discussing reusability, templates often come up. Reusable templates are a foundational element of reusability for Anypoint Platform. These are the building blocks that drive consistency, enforce best practices and governance, enable new developers to onboard quickly, and accelerate the overall developments. Learn more about how to share a template on Anypoint Exchange.
The below sample diagram illustrates reusability using the above-discussed components at each stage of the API development life cycle:
Reusability should not be restricted to APIs alone. Reuse should be thought about at each stage of the development lifecycle to reveal opportunities for accelerated delivery and consistency.
To learn more about how to build your enterprise for reuse, download our Composable enterprise eBook.