Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
@cxcloud/process-engine-core
Advanced tools
A simple helper for using multiple AWS SQS queues at the same time. This tool provides an easy way to map incoming events to actions.
npm install @cxcloud/process-engine-core
import {
createQueueProcessor,
createQueuePool
} from '@cxcloud/process-engine-core';
const pool = createQueuePool([
createQueueProcessor(
{
name: 'my-sqs-queue',
concurrency: 2
},
[
{
conditions: [
{
path: 'myEvent.name',
value: 'someValue'
},
{
path: 'customer.type',
value: 'gold'
}
],
action: (message, sendMessage) => {
console.log('Received Message:', message.data);
message.deleteMessage().then(() => {
// Next should be called after each message is processed
message.next();
});
}
}
],
// CatchAll function (for events that don't match any of the processors)
message => {
console.error('No processor found');
message.next();
}
),
createQueueProcessor(/* ... */),
createQueueProcessor(/* ... */)
]);
pool.start();
This function creates a queue pool that can be started at the same time and queried to access each item.
The resulting QueuePool
instance has the following methods:
start()
— Start all the queue processor instancesfindByName(name: String) ⇒ QueueProcessor
— Find a queue processor instance
by it's nameoptions
(Object)
process.env.AWS_REGION
process.env.AWS_ACCESS_KEY
process.env.AWS_SECRET_KEY
actionMap
(Array of ActionMap
). Each ActionMap
(Object):
conditions (Array of Objects) — An array of conditions to meet. All of the conditions must be met for the function to be triggered.
action (Function) — The action function to be called when the conditions are met for a received event. Params:
event (Object) — The received evemt
type (String): default is "Message"
data (Unknown): JSON.parsed message.Body or a string (if could not be parsed)
message (Object): reference to the received message
name (String): name of the remote queue
url (String): url of the connected queue
deleteMessage() ⇒ Promise (Function):
Helper to deleteMessage (or SQS.deleteMessage()
) when the job is
completed.
changeMessageVisibility(timeout) ⇒ Promise (Function):
Helper to changeMessageVisibility (or SQS.changeMessageVisibility()
)
when the job is completed.
delay(timeout) ⇒ Promise (Function):
Helper to changeMessageVisibility (or SQS.changeMessageVisibility()
)
without completing the job.
sendMessage(params = {}) ⇒ Promise (Function): send a new message in the queue
next() (Function): call this method when you've completed your jobs in the event callback.
sendMessage(params = {}) ⇒ Promise (Function) — A shortcut to send a message to the same queue processor that the event came from
fallbackFn
— A fallback action in case a message doesn't match any
conditions. Signature is same as the action
mentioned above.
FAQs
Process Engine Core for CX Cloud
We found that @cxcloud/process-engine-core demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.