FoundatioFx / Foundatio.AzureServiceBus

Foundatio Azure ServiceBus
Apache License 2.0
19 stars 15 forks source link

Can we create topic subscription problematically using .net core 2 #3

Open LilanSilva opened 6 years ago

LilanSilva commented 6 years ago

is that possible ?

niemyjski commented 6 years ago

@LilanMadusankaSilva We have a net standard client 6.1 client located on our nightly nuget feed on myget (https://www.myget.org/gallery/exceptionless) See this for more info (https://github.com/FoundatioFx/Foundatio.AzureServiceBus/pull/2)

If you specify your azure ad credentials it will create topic subscription you define in the passed in options for you. But we don't expose any management api's directly to do any management other than delete the queue. We are not going to be releasing this other than a nightly feed until Microsoft brings back the connection string based management features as requiring AD credentials to even create a topic is insane. Does this help?

@shahbarkha Am I missing anything?

shahbarkha commented 6 years ago

@LilanMadusankaSilva @niemyjski - Thats correct. We don't expose separate API to manage any entities like creating/deleting topic subscriptions . Although we ensure they get created as soon as the user tries to send or recv the message to and from the topic through PublishAsync and SubscribeAsync. So programatically topics are getting created though above APIs.

LilanSilva commented 6 years ago

@shahbarkha - I used code to read subscription message (I create topic manually using azure portal but I want to create subscription programmatically, so I used below code, but that code didn't create subscription with given name) IAzureSubscriptionReceiver<Message> receiver = new AzureSubscriptionReceiver<Message>(settings); receiver.Receive(

So, Can I create topic subscriptions programmatically? Can you give me sample code for that?

shahbarkha commented 6 years ago

@LilanMadusankaSilva Which code are you accessing? I don't see that we are using IAzureSubscriptionReceiver anywhere.

You should use IMessage interface to access the functionality. Something like this: IMessageBus messageBus = new AzureServiceBusMessageBus(new AzureServiceBusMessageBusOptions() { Topic = "Topic1", SubscriptionName = "Subscriber1", ConnectionString = "Endpoint=sb://nnn.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=lpgwMXDswO3SgJkfEPoF/pZ/=", SubscriptionId = "69636ii3-911f-4ac0--12d6126471df", ResourceGroupName = "resourcegroup", NameSpaceName = "namespace", Token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6IlZXVkljMVdEMVRrc2JiMzAxc2FzTTVrT3E1USIsImtpZCI6IlZXVkljMVdEMVRrc2JiMzAxc2FzTTVrT3E1USJ9.-2apM8DZztG6fZMhJLCts_PsKMh0-u3j2boG_bfFFxI9OwgxYqDWonQMVAhHlANgM3KEmEoKv_4WgG7rawamipi6JAGTejfVOQeaoUZFCHbC0N02hMNeaReyhj8gukwmQMruUOTA_u9STM5ra13BSiZZMH8OSS3HwvnI5-nkIzbQqdOD5KaR1PDPMMHKR104lX43zhK9HyJvPlv1d16BwT8ejoAUfIrJ0zxgFpsPoJg1XdVkS7FA5XB_Js0bCt5Kto0EXltx8H5bcpTB5kjZvPVsv9TmakwwutOv9dPBDU36euSNMaLjEQ" }); messageBus.SubscribeAsync(msg => { Console.WriteLine(msg); }).GetAwaiter().GetResult();

LilanSilva commented 6 years ago

If you can please provide me working sample code?