BizTalk "Get Last Message" pattern

There is acase:
One part of the solution periodically publishes the data.This part is out of this article.
There are two kind of subscribers.
One kind of subscribers want to get the messages while they are published.
Second kind of subscribers pool this messages randomly:
  • undefined quantity of the subscribers request the undefined number times the LAST message in random interval.
  • they want toget the last input message only.
The usual publish-subscribe pattern doesn’t work, because
  1. the usual subscriber MUST receive ALL published messages. It cannot omit several and receive only others. (It can but it have to implement this logic by itself, it is not the case.)
  2. After subscriber received the message, it cannot receive this message one more time. The message pops out of the query.
  3. After one subscriber received the message, the other subscriber cannot receive the same message if it is not subscribed to the message. It is not a “random” , “one time”, “randomly appeared/disappeared”subscriber.
The question is: How can I do this in “BizTalk style”?

The orchestration implements this “Get Last Message” pattern.
The orchestration has three parts.
One is for controlling this orchestration. It starts and stops the orchestration by the Control messages (Control START and Control STOP). That’s all.
The second part is a part of the pattern. It receive all input messages (Trips_Canonical) in the Unifies Sequential convoy. Usually in the samples there are two receive shapes, one before and one inside the loop. I use the receive for the control message as an activate receive, it helps me to simplify the orchestration.
The third part is a part of the pattern too. It is compounded from the receive shape which requests the last message (Get LastRequest message), and the send shape, which send this last message. The last message isthe same as the input message, the only difference is in thevalue of the”ProcessName” element.
This sample is used in the content routed scenario that’s why there are several interesting points.
  • all messages have one first level node, right under root node with name “ProcessName”. This node holds the name of the message publisher. This helps route the messages with the same message type to different routes. For example, the input Trip_Canonical messages and the output Trip_Canonical have different values of this node, and this is the only difference.
  • the messages correlated by this “ProcessName” node (the cor_ApplicationName Correlation set).
  • I use the Decide shape to avoid to send the requested last message if I have nothing to send. But to get this project built I have to create the “foo” message.
  • I gather all receives under one direct port. This is an Ordered delivery=True port.

    Maybe it worth to include the send port under this port too.


There are the Control messages:
START:
STOP:
Input message the “Trips_Canonical”:
Get LastRequest message:
Last message:

Workflows are not java – its not write once run everywhere

Workflows are not java – its not write once run everywhere

Having spoken, taught, and consulted about Windows Workflow Foundation for over two
years I’ve run into a number of common misconceptions about WF.

One common misconception is that WF is a write-once run-anywhere technology. 
Some people feel like if they write a workflow to run inside of a particular host
(let’s take SharePoint) – that those workflows will be able to run inside of another
host (let’s imagine the next version of BizTalk which has already been announced will
run WF workflows natively as its “Orchestration” engine).  The answer is almost
*all* cases is a resounding NO (there are a few small exceptions to this rule but
they are hardly worth mentioning).

In  WF a Host has to know how to interact with Workflows,  when to create
them, when to use an existing Workflow Instance, and most importantly how to communication
with a running workflow (this is probably the #1 reason why workflows are not portable
among workflow hosts).

So a workflow you build today for SharePoint is intended only to run in SharePoint. 
A workflow you build for a custom Host is likely only to run in that custom Host –
it is very very unlikely that you’ll be able to take a workflow built for a custom
Host and run it in the next version of BizTalk (and I have no inside knowledge of
what workflows inside of the next version of BizTalk will look like – although I think
you can probably intuit that from what’s in Orcas in terms of the WCF-WF integration).

This blog post came to me when I was doing a talk about the BizTalk
Extensions for WF
a few weeks ago and someone asked about running the workflows
I show inside of another host (like SharePoint or the next version of BizTalk). 
This of course was not the first time I’d gotten that question (or questions like
it).  But then this idea came to me,  because of course when I said “No” 
the followup question was “Well – then why would I want to invest in Workflow if my
Workflows I build today won’t likely run in the next version of BizTalk?”.

My answer – and the point of this post – is that the atom of reuse in WF isn’t at
the Workflow/Root level.  The atom of reuse in WF is Activities.  
Even thought  a Workflow built for SharePoint won’t run in another host – if
you build custom activities to encapsulate your programming logic – those Activities
will be able to be reused in other Workflows (and likely other Workflow Hosts as well
– although there are some exceptions – the most glaring of course is Activities that
relate to communication – since that is often the most host specific type of activities).

So any investment you make in WF will pay off in different hosts – both in terms of
general knowledge about how WF works – as well as your investment in custom Activities.



Check out my BizTalk
R2 Training.

BizTalk RFID USB devices accessed from Virtual PC! – great Software!

Another piece of software has come up and saved my bacon – a couple of days out from
a conference and I would love to Demo RFID. Do I migrate my images to VMWare? (that’s
another story in itself – I’ve heard good + bad)

After researching I came across this……. USB
Anywhere

This guy is GREAT!! Let’s you share USB devices via IP addresses between host
+ remote machines.


(you even get plug and play messages!)

Now all my RFID devices are rocking!!!

XPathmania and XPath on TV!

I’ve blogged about the Visual Studio extension XPathmania before. It’s a very simple little tool that lets you write and test XPath inside of Visual Studio 2005. No big deal if you already have tools like XMLSpy or XML Notepad but still. I like not having to start another application, opening the XML document I’m working with and so on. Doing stuff inside of Visual Studio just feels right and saves some time anyway.

One of the last episodes of dnrTV hosted Dom Demsak (Don XML), the creator of XPathmania. The show is 30% about XPathmania and 70% about XPath and XPath syntax in general. It’s kind of basic XPath but I think it can be useful for someone who feels they haven’t got full control of the language.

During the show they touch on XML namespaces and XML default namespaces. However they don’t really explain the difference between them and how it effects the document. Something that’s sad as I feel that XML namespaces (and especially default namespaces) is something that most people haven’t fully understood.

Anyway, if you got some spare time watch it or forward it someone you think should watch it. 😉

XPathmania and XPath on TV!

I’ve blogged about the Visual Studio extension XPathmania before. It’s a very simple little tool that lets you write and test XPath inside of Visual Studio 2005. No big deal if you already have tools like XMLSpy or XML Notepad but still. I like not having to start another application, opening the XML document I’m […]

XPathmania and XPath on TV!

I’ve blogged about the Visual Studio extension XPathmania before. It’s a very simple little tool that lets you write and test XPath inside of Visual Studio 2005. No big deal if you already have tools like XMLSpy or XML Notepad but still. I like not having to start another application, opening the XML document I’m […]