Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@azure/core-amqp

Package Overview
Dependencies
Maintainers
0
Versions
406
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@azure/core-amqp

Common library for amqp based azure sdks like @azure/event-hubs.

  • 4.3.3
  • latest
  • npm
  • Socket score

Version published
Maintainers
0
Created

What is @azure/core-amqp?

@azure/core-amqp is a library that provides core functionality for working with the Advanced Message Queuing Protocol (AMQP) in Azure services. It is primarily used as a building block for other Azure SDKs that need to communicate over AMQP, such as Azure Service Bus and Azure Event Hubs.

What are @azure/core-amqp's main functionalities?

AMQP Connection Management

This feature allows you to establish and manage AMQP connections. The code sample demonstrates how to create a connection context and open a connection using a connection string.

const { ConnectionContext } = require('@azure/core-amqp');

async function createConnection() {
  const connectionContext = ConnectionContext.create({
    connectionString: 'your-connection-string',
    options: {}
  });
  await connectionContext.connection.open();
  console.log('Connection established');
  return connectionContext;
}

createConnection().catch(console.error);

AMQP Sender and Receiver

This feature allows you to send and receive messages over AMQP. The code sample demonstrates how to create a sender to send a message and a receiver to receive messages from a specified queue.

const { ConnectionContext, Sender, Receiver } = require('@azure/core-amqp');

async function sendMessage() {
  const connectionContext = await createConnection();
  const sender = new Sender(connectionContext, 'queue-name');
  await sender.send({ body: 'Hello, World!' });
  console.log('Message sent');
}

async function receiveMessage() {
  const connectionContext = await createConnection();
  const receiver = new Receiver(connectionContext, 'queue-name');
  receiver.on('message', (message) => {
    console.log('Received message:', message.body);
  });
}

sendMessage().catch(console.error);
receiveMessage().catch(console.error);

AMQP Error Handling

This feature provides mechanisms for handling errors that occur during AMQP operations. The code sample demonstrates how to handle errors when establishing a connection.

const { ConnectionContext } = require('@azure/core-amqp');

async function createConnectionWithErrorHandling() {
  try {
    const connectionContext = ConnectionContext.create({
      connectionString: 'your-connection-string',
      options: {}
    });
    await connectionContext.connection.open();
    console.log('Connection established');
    return connectionContext;
  } catch (error) {
    console.error('Error establishing connection:', error);
  }
}

createConnectionWithErrorHandling().catch(console.error);

Other packages similar to @azure/core-amqp

Keywords

FAQs

Package last updated on 08 Nov 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc