![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Easy, type-safe worker (bee) processes using AMQP. Offload resource-intensive jobs so you can get back to making that honey 🍯.
Easy, type-safe worker (bee) processes using AMQP. Offload resource-intensive jobs so you can get back to making that honey 🍯.
npm install amqp-hive
Create a TypeScript type mapping the name of each job queue to its payload.
type Payloads = {
sendEmail: { emailAddress: string; body: string };
};
Note: You can skip this step if not using TypeScript, but you will not have completion or type safety when dispatching jobs or creating workers.
Whether you're creating a dispatcher or worker, first create a Hive instance.
const hive = createHive<Payloads>(connection, {
queues: {
sendEmail: {
// queue configuration
},
},
});
Note: The connection you pass to
createHive
should be aConnection
object returned byampqlib
'sconnect
function. You may also pass in a Promise that will resolve to aConnection
instead.
Create a dispatcher instance and dispatch jobs.
const dispatcher = hive.createDispatcher();
await dispatcher.dispatch("sendEmail", {
emailAddress: "some@email.com",
body: "Hello!",
});
Create a worker that processes jobs from a specific queue:
const dispatcher = await hive.createWorker(
sendEmail: {
onMessage: async ({ emailAddrss, body }) => {
// process the job
},
},
);
The worker's onMessage
function returns a Promise. If the Promise resolves, the message is acknowledged. If the Promise rejects, the message is rejected and will be dropped, dead-lettered or retried depending on the queue configuration.
export type HiveConfiguration<
TPayloadsByQueueName extends Record<string, any>
> = {
exchanges?: Record<
"direct" | "delayed",
{
name?: string;
options?: Options.AssertExchange;
}
>;
queues: Record<
keyof TPayloadsByQueueName,
{
isDelayed?: boolean;
options?: Options.AssertQueue;
publishOptions?: Options.Publish;
}
>;
};
Each job queue accepts some additional, optional parameters:
isDelayed
-- whether this queue accepts delayed messages.options
-- the object passed to Channel.assertQueue
when initializing a queue.publishOptions
-- the object passed to Channel.publish
when this method is called under the hood by Dispatcher.dispatch
.When creating a Hive
, two exchanges are created (one for regular messages and one for delayed ones). Each exchange can be optionally configured with a different name
and additional options
that will be passed to assertExchange
.
Note: The configuration object passed to each
Hive
instance should be identical since exchanges and channels will be asserted with the provided options whenevercreateHive
is called.
FAQs
Easy, type-safe worker (bee) processes using AMQP. Offload resource-intensive jobs so you can get back to making that honey 🍯.
The npm package amqp-hive receives a total of 3 weekly downloads. As such, amqp-hive popularity was classified as not popular.
We found that amqp-hive demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.