Search code examples
biztalkbiztalk-2013r2

The published message could not be routed because no subscribers were found


I have the following error when running my BizTalk package in the server:

The published message could not be routed because no subscribers were found

Package Description: Import a CSV flat file into SQL Server using a stored procedure.

enter image description here

Breakdown:

Create Table Code:

CREATE TABLE [dbo].[Accounts](
    [Id] [int] IDENTITY(1,1) NOT NULL,
    [AccountName] [nvarchar](150) NULL,
    [ServiceAddress] [nvarchar](150) NULL,
    [AccountNumber] [nvarchar](50) NULL,
 CONSTRAINT [PK_Accounts] PRIMARY KEY CLUSTERED 
(
    [Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

Create Stored Procedure Code:

CREATE PROCEDURE [dbo].[InsertAccount]
    @AccountName AS NVARCHAR(150) ,
    @ServiceAddress AS NVARCHAR(150) ,
    @AccountNumber AS NVARCHAR(50)
AS 
    INSERT  INTO dbo.accounts
            ( AccountName ,
              ServiceAddress ,
              AccountNumber
            )
            SELECT  @AccountName ,
                    @ServiceAddress ,
                    @AccountNumber

Flat File: Named it sample.csv

Account Name,Service Address,Account Number
JOE BLOW,ADDRESS X CITYX IL 61999,932F623Y52

I am using WCF to connect to the database enter image description here

I am using a stored procedure enter image description here

I created a schema for the flat file enter image description here

Receive Port Configuration

enter image description here enter image description here enter image description here

Send port configuration

enter image description here enter image description here enter image description here

I created a message to receive the flat file

enter image description here

I created a message to send the XML to SQL

enter image description here

I dropped the Receive component and assigned the Flat File Message enter image description here

I dropped the Send component and assigned the Stored Proc Message

enter image description here

I dropped a receive response component for the stored proc

enter image description here

Then I dropped a Construct Message component to initialize the XML document and create the map.

enter image description here enter image description here enter image description here

I deployed the package to the server, without deploying to the GAC, Then I registered the component in the GAC manually.

enter image description here

In the server:

I set all the receive and send ports:

enter image description here enter image description here enter image description here

Send port

enter image description here enter image description here

The I configure the application

enter image description here

I started the application:

  • Receive Location Enable
  • Send Port Started
  • I completely stop and restarted the application.

I drop the file, the file disappears and I get the error

I get the following errors

The Messaging engine failed to process a message submitted by adapter:FILE Source URL:C:\Biztalk Test\Sales\SampleFile*.csv. Details:The published message could not be routed because no subscribers were found. This error occurs if the subscribing orchestration or send port has not been enlisted, or if some of the message properties necessary for subscription evaluation have not been promoted. Please use the Biztalk Administration console to troubleshoot this failure.

A message received by adapter "FILE" on receive location "ServerReceiveLocation" with URI "C:\Biztalk Test\Sales\SampleFile*.csv" is suspended. Error details: The published message could not be routed because no subscribers were found. This error occurs if the subscribing orchestration or send port has not been enlisted, or if some of the message properties necessary for subscription evaluation have not been promoted. Please use the Biztalk Administration console to troubleshoot this failure.

enter image description here enter image description here


Solution

  • Basically the subscription on your Orchestrations does not match the context properties on the received message.

    Always when you get that error what you need to do is look at the Suspended message and see what it looks like and compare it's context properties with the Subscriptions in BizTalk Administrator.

    In you case the issue appears to be that you don't have a Receive Pipeline that has a Flat File Dissasembler with the flat file scheme specified on it which would convert it to XML and publish it with Message Type context property with the schema name

    So what is happening is that it it publishing the raw flat file to the message box without a message type, and Message Type is what the Orchestration is subscribing too, and you have no specific subscription rules to are listening for messages from that port that can then process the raw message. So it does not know what to do with the message and suspends it with the above error.