Giter Club home page Giter Club logo

Comments (14)

Jeffail avatar Jeffail commented on July 20, 2024 1

Hey @JohnRoesler thanks for trying it out. I'm assuming this is due to not having SASL auth set up yet, it should be quick to add.

from connect.

Jeffail avatar Jeffail commented on July 20, 2024

Hey @mintbridge, I don't see any major reason not to include it as an option. Since the protocols are so different I imagine the configuration fields we would expose would be completely different, in which case it ought to be a separate type within Benthos. Obviously, that puts us in an awkward position with amqp being 0.91 and then some other type being called amqp_1_0.

Any idea which broker implementations supporting 1.0 are most common? Would be nice to get an idea of use statistics and future prospects for both versions and maybe do some breaking config changes if we go down this route.

from connect.

Jeffail avatar Jeffail commented on July 20, 2024

Marking this as help wanted, right now I just want to collect use cases and opinions.

from connect.

mintbridge avatar mintbridge commented on July 20, 2024

yeah, i was thinking maybe do something with a version option, and just swap out the implementation underneath but yeah the config would be totally different

this has good list https://github.com/xinchen10/awesome-amqp but the one i'm after in particular is azure service bus

from connect.

holmanb avatar holmanb commented on July 20, 2024

This project looks wonderful, but without a more modern version of AMQP, I cannot use it. I assume no updates on this?

from connect.

Jeffail avatar Jeffail commented on July 20, 2024

Hey @holmanbph, the Go libraries on offer for AMQP 1.0 still seem a little premature, https://github.com/vcabbage/amqp still seems to be the safest bet but it's still not at version 1. However, I'm not opposed to adding it in as a beta component.

from connect.

Jeffail avatar Jeffail commented on July 20, 2024

I've renamed the existing amqp (0.91) components to amqp_0_9 and deprecated the existing ones, they'll get removed in V4. This opens us up to add amqp_1 (and potentially amqp_0_10 as well).

from connect.

mintbridge avatar mintbridge commented on July 20, 2024

👍

from connect.

holmanb avatar holmanb commented on July 20, 2024

Thanks for the update!

from connect.

JohnRoesler avatar JohnRoesler commented on July 20, 2024

It looks like the amqp 1.0 library was forked by azure https://github.com/Azure/go-amqp

from connect.

Jeffail avatar Jeffail commented on July 20, 2024

@mintbridge, @holmanb, @JohnRoesler, I finally got around to this 4f12998

I've added some very basic components and labelled them BETA, they're currently tested against ActiveMQ. There's work needed for supporting metadata/headers. I'll probably put a release out this evening. Is anyone interested in being a guinea pig and trying them out?

from connect.

JohnRoesler avatar JohnRoesler commented on July 20, 2024

@Jeffail wow, thanks for getting this going!

Doing some preliminary testing, I am not able to get it working with the benthos plugin to consume from an Azure Service Bus. However, if I use the underlying Go library I am able to consume. See snippets below.

input:
  type: amqp_1
  amqp_1:
    source_address: "/<EventHubName>/ConsumerGroups/<ConsumerGroupName>/Partitions/<PartitionNumber>"
    url: "amqp://<mydomain>.servicebus.windows.net/;SharedAccessKeyName=<name>;SharedAccessKey=<key>;"
output:
  type: stdout
  stdout:
    delimiter: ""
{"@timestamp":"2020-06-29T23:05:33-05:00","@service":"benthos","level":"ERROR","component":"benthos.input","message":"Failed to connect to amqp_1: *Error{Condition: amqp:unauthorized-access, Description: Unauthorized access. 'Listen' claim(s) are required to perform this operation. Resource: 'sb://<mydomain>.servicebus.windows.net/<event_hub>'. TrackingId:<tracking_id>, SystemTracker:gateway5, Timestamp:2020-06-30T04:05:32, Info: map[]}"}
package main

import (
	"context"
	"fmt"
	"log"
	"time"

	"github.com/Azure/go-amqp"
)

func main() {
	// Create client
	client, err := amqp.Dial("amqps://<mydomain>.servicebus.windows.net",
		amqp.ConnSASLPlain("access-key-name", "access-key"),
	)
	if err != nil {
		log.Fatal("Dialing AMQP server:", err)
	}
	defer client.Close()

	// Open a session
	session, err := client.NewSession()
	if err != nil {
		log.Fatal("Creating AMQP session:", err)
	}

	ctx := context.Background()

	// Continuously read messages
	{
		// Create a receiver
		receiver, err := session.NewReceiver(
			amqp.LinkSourceAddress("/<EventHubName>/ConsumerGroups/<ConsumerGroupName>/Partitions/<PartitionNumber>"),
			amqp.LinkCredit(10),
		)
		if err != nil {
			log.Fatal("Creating receiver link:", err)
		}
		defer func() {
			ctx, cancel := context.WithTimeout(ctx, 1*time.Second)
			receiver.Close(ctx)
			cancel()
		}()

		for {
			// Receive next message
			msg, err := receiver.Receive(ctx)
			if err != nil {
				log.Fatal("Reading message from AMQP:", err)
			}

			// Accept message
			msg.Accept()

			fmt.Printf("Message received: %s\n", msg.GetData())
		}
	}
}

The Azure Service Bus was provided to me, so I do not have access to tweak the settings for it. It appears to be a partitioned topic, so my understanding is that I would need to create multiple receivers - one for each partition (0,1,2,3).

from connect.

JohnRoesler avatar JohnRoesler commented on July 20, 2024

Confirmed the 3.20.0 release works 👍

input:
  type: amqp_1
  amqp_1:
    source_address: "/<EventHubName>/ConsumerGroups/<ConsumerGroupName>/Partitions/0"
    url: "amqps://<mybus>.servicebus.windows.net"
    sasl:
      mechanism: plain
      user: <user>
      password: "<password>"

from connect.

Jeffail avatar Jeffail commented on July 20, 2024

🎉

from connect.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.