I'm consuming data from an Azure Service Bus and I want to push it to an Azure Event Hub.
I've created a function like so:
[FunctionName("IntegrationFunction")]
[return: EventHub("%Transactions:EVH:Transactions:Hub%", Connection = "Transactions:SB:Transactions")]
public Transaction Run(
[ServiceBusTrigger(
"%Transactions:SB:Transactions:ReceiveTopic%",
"%Transactions:SB:Transactions:AnalyticsTopicSubscription%",
Connection = "Transactions:SB:Transactions")]
string mySbMsg,
ILogger log)
{
if (string.IsNullOrWhiteSpace(mySbMsg))
{
throw new ArgumentNullException(nameof(mySbMsg));
}
log.LogInformation($"Service bus topic trigger function processing message: {mySbMsg}");
var retailTransaction = JsonConvert.DeserializeObject<RetailTransaction>(
mySbMsg,
JsonSerialisationUtils.SerialiserSettings);
if (retailTransaction == null)
{
throw new JsonException("Deserialized transaction was null");
}
try
{
var transaction = retailTransaction.ToDto();
log.LogInformation($"Transaction {transaction.TransactionNumber} processed.");
return transaction;
}
catch (Exception e)
{
log.LogError(e, "Error mapping transaction.");
}
return null;
}
However, when the function is invoked, I receive the following error:
Put token failed. status-code: 404, status-description: The messaging entity 'sb://****.servicebus.windows.net/Transactions-EVH-INS-DEV-EUW' could not be found. To know more visit https://aka.ms/sbResourceMgrExceptions. TrackingId:**************, SystemTracker:****:Transactions-EVH-INS-DEV-EUW, Timestamp:2024-03-12T07:49:07.
Does that mean that the value of %Transactions:EVH:Transactions:Hub% is incorrect or something else? Why does the error mention service bus when I'm trying to publish to an event hub?
I've already read this article.
I am also getting the same error when I am trying to use the receiving
eventhub namein place oftopic name.Use correct syntax.
This worked for me.
My Code:
INPUT:OUTPUT: