XML debatch in pipeline

Last month I had a post were described how to debatch XML message in orchestration
How I wrote it is not the best solution , in case if you will have hundreds of records the debatching using XPath will consume too much memory and processor.

In this post I am going to show how to debatch using pipeline.
The sample will fetch multiple records from MS SQL database and after debatching put them to folder.

How to create simple WCF-SQL ports and SQL polling you can read in my old post
I will use the same procedure and table to generate Schemas and PortTypes

In generated schema change envelop type to yes



Next click on TypePolling which is the root for schema
In properties find Body XPath
and edit it as in picture is

Then change the last node to have Max Occurs = 1

Now we should remove hidden stones :-)

When you added adapter metadata from wizard to your project
PortType was generated, DO NOT use it while creating logical receive port in orchestration.
DO NOT Use multipart message type while creating Message
your mesage now has simple structure



Thats all
now in output folder you should have many files where each will contain a single record from SQL



Comments

Brad said…
Hey, thanks for your post but I'm not getting it to work right. Richard Serotor has a similar blog about this but neither are working for me. I'm still getting a single XML file with multiple records from my db.

I'm using TypedPolling to get my schema and data from db. I changed the Schema to Envelope=Yes, updated the Body XPath, and set leaf node to Max Occurence = 1. Created a File Send port to consume the receive port (no orchestration) but I'm still getting a single file in output folder.

What am I missing? Thanks!
hi Brad
It should be Ok

leave me your email, I will send a solution MSI file, where you can check it. (next week)
Gilson said…
Hello Armen,

Is this possible (debatch using pipeline) with the schemas created by the Select operation in the Consume Adapter Service wizard?

Thanks,

Gilson
Gilson said…
Hello Armen,
Is it possible to debatch in the pipeline using the schemas generated by the Select method of the Consume Adapter Service wizard?
Regards,
Gilson
Hi
Sure , if your schema is Taken from WCF-SQL adapter you can debatch in the same way.
Changing that values will not break your XSD
Anonymous said…
Hi,
Thanks for your post..
Remove hidden stones section help to solve my problem
thanks again.....

Regards,
Nilesh
simonvinyl said…
Hi I am designing a messaging solutuion not using any Orchs and want to recieve a batch as a whole message in the messge box then debatch on the send pipeline as i call a Stored Proc. Can this be done?

Thanks
hi
sure you can do it in the same way as described latter
Anonymous said…
Thanks for the article. Really useful. I managed to get it to work for my project. But the result set is duplicating after debatching. For example if I have two records in the database table, debatch gives me four records. one duplicate record for each record. What I am I doing wrong? Thanks
Hi
Check pooling interval,
also check that you mark that records as retrieved so next time SP will skip records.

run SQL profiler to understand what's going on
OldBeno said…
Armen,

Thanks for the details I am now debatching my messages on the pipeline ;)

Much Appreciation,
OldBeno
OldBeno said…
Armen,

Thanks for the details I am now debatching my messages on the pipeline ;)

Much Appreciation,
OldBeno

Popular posts from this blog

How to poll database using WCF-SQL adapter

SQL query timeout from application but works fast from SSMS