@solace-community/eventportal
v1.4.0
Published
This is a wrapper to Solace PubSub+ Event Portal REST API
Downloads
13
Keywords
Readme
Solace Pubsub+ Event Portal REST API Wrapper
This module wraps the Solace PubSub+ EP REST API. This can be used to enable the creation of integrations, plugins, and component on top of the Solace PubSub+ Event API.
Dont forget to give this repo a star! ✨
Installation
npm install @solace-community/eventportal
Constructor
const EventPortal = require('@solace-community/eventportal')
const ep = new EventPortal()
// Optional: You can pass Solace Cloud Token as parameter if not defined as environment variable
const ep = new EventPortal(SOLACE_CLOUD_TOKEN)
How to use
Check out the create.js
script in the example directory for API usage.
Here is a video as well
Environment Variables
| Env Variable | Description | | ------------------ | ------------------------------------------- | | SOLACE_CLOUD_TOKEN | Solace Cloud Token with the right EP access |
Methods
domain = {
name: "Application Domain name",
description: "Application Domain description",
uniqueTopicAddressEnforcementEnabled: true,
topicDomainEnforcementEnabled: false,
type: "ApplicationDomain"
}
Returns
- Application Domain ID
Notes
- If Application Domain name exists, matching Application Domain ID is returned
schema = {
applicationDomainId: domainID,
name: "Schema1",
shared: false,
contentType: "json",
schemaType: "jsonSchema"
}
Returns
- Schema Object ID
Notes
- If the Schema name exists, matching Schema Object ID is returned
schemaVersion = {
schemaID: schemaID,
description: "This is the schema version description",
version: "0.0.1",
displayName: "This is the Display name of the schema",
content: JSON.stringify(schemaContent),
stateID: "1"
}
Returns
- Schema Object ID
Notes
- If the Schema version exists and overwrite is not set, an error is thrown
- The schema content is in string format
- Setting the overwrite flag to true will overwrite the schema if the State is
DRAFT
otherwise throws an error
event = {
applicationDomainId: domainID,
name: "Event Name",
shared: false
}
Returns
- Event Object ID
Notes
- If the Event name exists, matching Event Object ID is returned
eventVersion = {
eventID: eventID,
displayName: "Scripted Version",
version: "0.0.1",
schemaVersionId: schemaVersionID,
deliveryDescriptor:{
brokerType: "solace",
address:{
addressLevels
},
stateID:"1"
}
}
Returns
- Event Object ID
Notes
- If the Event version exists and overwrite is not set, an error is thrown
- Setting the overwrite flag to true will overwrite the event if the State is
DRAFT
otherwise throws an error - the
addressLevels
parameter is an array with the following format
let addressLevels = [
{name: "level1", addressLevelType: "literal"},
{name: "level2", addressLevelType: "variable"},
{name: "level3", addressLevelType: "literal"},
{name: "level4", addressLevelType: "variable"},
]
application = {
applicationDomainId: domainID,
name: "My Scripted Application",
applicationType: "standard",
}
Returns
- Application Object ID
Notes
- If the Application name exists, matching Application Object ID is returned
applicationVersion = {
applicationID: applicationID,
displayName: "Display Name",
description: "This is the scripted description",
version: "0.0.1",
declaredProducedEventVersionIds:[eventVersionID],
type: "application"
}
Returns
- Application Object ID
Notes
- If the Application version exists and overwrite is not set, an error is thrown
declaredProducedEventVersionIds
is an array of produced eventsdeclaredConsumedEventVersionIds
is an array of consumed events- Setting the overwrite flag to true will overwrite the application if the State is
DRAFT
otherwise throws an error
To-Do
- [ ] Add Jest unit tests
- [ ] Add Enum support