我在Windows Service Bus 1.0的前提下运行,我得到了例外MessaingEntityNotFoundException 40400: Endpoint not found.
这是因为没有创建队列吗?我无法在服务器上的任何地方看到我可以创建队列(我正在使用2K8R2),当我运行服务总线配置工具时,它只询问我是否要从服务器场中删除.
我是否需要添加一个队列,如果有的话是gui或powershell脚本,还是我做了别的错误?
app.config中的连接字符串
<appSettings>
<!-- Service Bus specific app setings for messaging connections -->
<add key="Microsoft.ServiceBus.ConnectionString" value="Endpoint=sb://sqldev1.domain.local/domaintest1;StsEndpoint=https://sqldev1.domain.local:9355/domain-test1;RuntimePort=9354;ManagementPort=9355" />
</appSettings>
Run Code Online (Sandbox Code Playgroud)
代码如下:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.ServiceBus;
using Microsoft.ServiceBus.Messaging;
using System.Threading.Tasks;
namespace WindowsServerEventBus
{
class Program
{
static void Main(string[] args)
{
MessagingFactory messageFactory = MessagingFactory.Create();
NamespaceManager namespaceManager = NamespaceManager.Create();
QueueClient myQueueClient = messageFactory.CreateQueueClient("WowWowWee");
BrokeredMessage sendMessage = new BrokeredMessage("Hello World!");
myQueueClient.Send(sendMessage);
BrokeredMessage receivedMessage = myQueueClient.Receive(TimeSpan.FromSeconds(5));
if (receivedMessage …Run Code Online (Sandbox Code Playgroud) 我正在写一段代码,这将允许我们:
前2分我没有问题; 使用Peek接收模式,我可以显示消息列表,我们可以编辑和重新发送,没有任何问题.
当我想从死信队列中删除消息时,问题就来了.
我们如何通过消息级别对消息执行此操作?我们可能只想删除驻留在死信队列中的2条消息,并保留其他消息以便稍后查看.调用.Complete()死信队列中的消息是否像在主订阅中那样删除它?
以供参考; 这是我们获取SubscriptionClient死信队列的代码:
private SubscriptionClient GetOrCreateSubscriptionClient(string connectionString)
{
if (!NamespaceManager.TopicExists(_topicName))
{
NamespaceManager.CreateTopic(new TopicDescription(_topicName)
{
MaxSizeInMegabytes = 5120,
DefaultMessageTimeToLive = TimeSpan.FromSeconds(DEFAULT_LOCK_DURATION_IN_SECONDS)
});
}
if (!NamespaceManager.SubscriptionExists(_topicName, _subscriptionName))
{
NamespaceManager.CreateSubscription(_topicName, _subscriptionName);
}
var deadLetterPath = SubscriptionClient.FormatDeadLetterPath(_topicName, _subscriptionName);
var client = SubscriptionClient.CreateFromConnectionString(
connectionString, deadLetterPath, _subscriptionName, ReceiveMode.PeekLock);
return client;
}
Run Code Online (Sandbox Code Playgroud) 我们继续看到Azure Service Bus的不稳定性,并正在寻找替代方案.理想情况下,我们希望能够在Windows 2012 R2域中本地运行并具有许多与Azure SB相同的功能集.我们已经看过Windows 1.1 Service Bus,但该产品暂时没有更新,我们不确定它的未来.我们使用C#,因此理想情况下会有一个客户端API /包装器,它可以使我们与现有应用程序的集成相对容易.开源和免费软件是完全可以接受的.:-)
背景技术在几周之内,我们已经在我们选择托管队列的数据中心中关闭了SB.我们已经迁移到另一个数据中心,它偶尔也会出现问题.问题通常持续2分钟到几乎整整一天,最终微软让它们再次运行.
我是Azure Service Bus的新手,我正在尝试建立用于排队消息的事务策略。由于SQL Azure不支持MSDTC,因此不支持MSDTC,因此无法使用它。因此,我有一个可以手动处理数据库事务的工作单元。
问题是我只能找到使用TransactionScope来处理数据库和Azure Service Bus操作的人员。在不使用TransactionScope的情况下,还有其他神奇的方法可以在Service Bus上实现事务吗?
谢谢。
我们的应用程序使用 Azure 服务总线进行消息传递。我们创建了几个主题和订阅者。我们每天将发送大约 500 条消息,但在图中它显示了对 500 条消息的数十万个请求。我们的计费价格也是每月 800 美元左右。这对于 500 * 30 条消息来说太多了。我不明白为什么价格这么高,而且我想知道图中的请求是什么意思?。
如果价格的原因是因为请求数量,那么我该如何减少请求数量?。我正确看到的消息。问题仅在于请求。
我的函数将从现有的 ServiceBus 主题触发。我已经使用 VS2017 (15.3) 预览版中的新工具创建了该函数,作为编译函数。
如何在本地测试此功能?
azure azureservicebus azure-servicebus-topics azure-functions
我不明白为什么下面引用的以下处理程序(processMessageAsync)没有针对特定主题名称触发,但针对其他主题名称触发:
subscriptionClient.RegisterMessageHandler(processMessageAsync, msgOptions)
Run Code Online (Sandbox Code Playgroud)
以下是我的订阅者类:
open System
open System.Linq
open System.Threading
open System.Text
open System.Threading.Tasks
open Microsoft.Azure.ServiceBus
type Subscriber(connectionString:string, topic:string, subscription:string) =
let mutable subscriptionClient : SubscriptionClient = null
let exceptionReceivedHandler (args:ExceptionReceivedEventArgs) =
printfn "Got an exception: %A" args.Exception
Task.CompletedTask
let processMessageAsync (message:Message) (_:CancellationToken) =
try
let _ = Encoding.UTF8.GetString(message.Body)
subscriptionClient.CompleteAsync(message.SystemProperties.LockToken) |> Async.AwaitTask |> Async.RunSynchronously
Task.CompletedTask
with
_ -> Task.CompletedTask
member x.Listen() =
async {
subscriptionClient <- new SubscriptionClient(connectionString, topic, subscription)
subscriptionClient.OperationTimeout <- TimeSpan.FromMinutes(3.0)
let! rulesFound = …Run Code Online (Sandbox Code Playgroud) 我看到了有关 Azure Functions 版本 3 的Azure 服务总线输出绑定的 Microsoft 文档。当我想将消息发送到服务总线作为函数的返回时,我可以使用以下代码:
[FunctionName("ServiceBusOutput")]
[return: ServiceBus("myqueue", Connection = "ServiceBusConnection")]
public static string ServiceBusOutput([HttpTrigger] dynamic input, ILogger log)
{
log.LogInformation($"C# function processed: {input.Text}");
return input.Text;
}
Run Code Online (Sandbox Code Playgroud)
当我想将 2 条消息作为输出发送到不同的服务总线时,我的问题就开始了。是否可以输出绑定多个输出?在在线编辑器中,您可以添加多个输出。我怎样才能在代码中做到这一点?
在文档中有一个用法部分,它解释了我可以使用什么作为输出绑定。他们提到ICollector<T>或IAsyncCollector<T>但我不确定这就是我要找的。
另一个问题是,如果 API 将一个值返回给总线,将另一个值返回给用户,会发生什么情况?
我想在本地模拟 Azure 服务总线进行测试。
原始代码如下所示:
var client = new QueueClient("Endpoint=sb://host/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey="xxx",
"myqueue");
await client.SendAsync(message);
Run Code Online (Sandbox Code Playgroud)
消息将通过 ServiceBusTrigger 在 AzureFunction 中接收。
我相信可以将 Endpoint 更改为 localhost,然后建立一个在 localhost 上侦听的服务器来接收和转发消息。但我该怎么办呢?
首先,Microsoft.Azure.ServiceBusSDK是否使用AMQP协议发送消息?那么,我必须建立一个处理 AMQP 消息的服务吗?
搜索文档后,Service Bus 似乎还支持 REST 方式发送消息。我们可以在Microsoft.Azure.ServiceBusSDK 中做到这一点,以便我可以轻松构建一个 http 服务器来处理消息。
这项任务确实需要一些想法。
I'm attempting to access Azure Service Bus using a managed identity from my code. At the moment I'm just trying this locally.
When I debug my code I get the following error
System.UnauthorizedAccessException: Put token failed. status-code: 401, status-description: InvalidIssuer: Token issuer is invalid
Here is my service bus instance
Here is my user with Azure Service Bus Data Owner permissions
And here is my code
_client = new ServiceBusClient("oconnorevents.servicebus.windows.net", new DefaultAzureCredential());
Run Code Online (Sandbox Code Playgroud)
I am logged into Visual Studio as the …
azureservicebus ×10
azure ×7
c# ×3
azure-servicebus-subscriptions ×1
dead-letter ×1
queue ×1
servicebus ×1
transactions ×1