Simple Script to Terminate All Orchestration Instances

Tired of having to go into BizTalk Server Admin and terminate any suspended Orchestration instance before you want to redeploy?

Scripting this task is very simple using WMI. Just create a file called Terminate.vb and copy in this code:

TerminateAllOrchs

Sub TerminateAllOrchs

  Query = "SELECT * FROM MSBTS_ServiceInstance where ServiceClass = 1"

  Set InstSet = GetObject("Winmgmts:!root\MicrosoftBizTalkServer").ExecQuery(Query)

  For Each Inst In InstSet

    Inst.Terminate

  Next

End Sub

Running the script will terminate all Orchestration instances.

Note: This will terminate all Orchestrations so please use caution.

It could be further parameterized to only terminate specific Orchestrations.  The Query would look like:

Query = "SELECT * FROM MSBTS_ServiceInstance where ServiceClass = 1 and AssembliName='<name>'"

With <name> being the Assembly name of the Orchestration.

If you are using a helper .net class in your Solution, you can set this up as a pre or post build event so every time you deploy you'll not have to worry about deployment errors due to suspended Orchestration instances. 

To set this up, just put the path to the vb script file in the event text box.

Again, I better stress this should only be used in cases that you are sure terminating all Orchestrations is what you really want to do.  But it can be a great time saver for development.

How to Auto-GAC your BizTalk Helper Classes on a Successful Build

Working with helper .net classes with BizTalk is a common task. 

 

Sometimes it can be easy to forget to GAC the latest version of the code when you go to test the solution on your local development box.  With a simple Post Build Event, you can have your code automatically put in the GAC for you. 

 

Adding the post build event is easy.  Just go to the project properties of your helper class and select Build Events. 

 

Enter the following under Post Build Event:

 

"C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\gacutil.exe" /i $(TargetPath)

 

Now when you build your code your dll will be GACed for you.

Service Broker adapter scenario

There are many typical scenarios in which Service Broker is the ideal solution for interactions between BizTalk and SQL Server. Last week one of our solution architects point to a scenario that he was facing with a customer. The challenge was to avoid simultaneous polling of the SQL Server adapter in a topology with two BizTalk Servers (no master MessageBox) hitting the same SQL Server database. Richard Seroter described this scenario really well a year ago. At the end we implemented the classic solution using SERIALIZABLE transactions to avoid concurrent reads. It worked perfectly but is well known that in other scenarios this technique can introduce unnecessary locks.

This brought to my mind one of the most important features of Service Broker: Conversation Locks. Service Broker uses conversation group locks to guarantee that only one application can process a related set of messages at any given time. Conversation group locks to guarantee that messages are processed exactly once, in order. Locking occurs for the conversation group rather than for the conversation ID.

Using conversation locking we can implement the explained scenario with no additional effort. Just need to associate the two locations with the same conversation group and the solution is ready to go. The additional advantage on this approach is that the entire DB is abstracted through the Service Broker queue. BizTalk Server has no knowledge of the internal database schema which removes any dependencies between the BPM and DB tiers.

Share this post: Email it! | bookmark it! | digg it! | reddit!

Auto-GAC your BizTalk Helper Classes with Post Build Events

Working with .net helper classes in BizTalk Server is a common occurance. 


 


It can sometimes be easy to forget to GAC the latest version of the code when you go to test the solution on your local development box.  But using a simple Post Build Event, you can have your code automatically put in the GAC for you. 


 


Adding a post build event is easy.  Just go to the project properties of your helper class and select Build Events. 


 


Enter the following under Post Build Event:


 


“C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\gacutil.exe” /i $(TargetPath)


 


Now when you build your .net code your dll will be GACed for you.

Inside BizTalk Web Service Proxy – Operation Binding

In service-oriented solution I designed there was an interface where some operations were handled by BizTalk while some were just straight data services with no need for orchestration. The idea was to keep web service operations in one endpoint for business reasons, security and operational considerations. Using WCF way of describing interface example may look like this:


[ServiceContract(Name=“TestService”, Namespace = “http://mynamespaces.com/TestService”)]
public interface ITestService

{
  [OperationContract(Name =
“ProcessItem”,
    Action=“http://mynamespaces.com/TestService/ProcessItem“,
    ReplyAction=“http://mynamespaces.com/TestService/ProcessItemResponse”
)] 
  ProcessItemResponse ProcessItem(DataItem item);

  [OperationContract(Name=
“GetDataItem”,
    Action=http://mynamespaces.com/TestService/GetDataItem,
    ReplyAction=“http://mynamespaces.com/TestService/GetDataItemResponse”
)]
  DataItem GetDataItem(DataItemInfo info);
}


ProcessItem operation is BizTalk orchestration exposed as web service and GetDataItem is a simple data service that does not require orchestration. The question is how to generate WSDL contract and server proxy knowing that BizTalk publishing process will override any changes we make to the proxy code. It is quite possible since BizTalk proxy derives from System.Web.Services.WebService class and is defined in partial class. All we need is to put BizTalk operations in one code file and the rest into another and provide proper binding declarations on them. Here’s code for BizTalk part of the TestService.cs:


    [System.Web.Services.WebServiceBindingAttribute(
        Name
=TestService,
        ConformsTo
= System.Web.Services.WsiProfiles.None,
        EmitConformanceClaims
= false)]
    [System.Web.Services.WebServiceAttribute(
        Name
=TestService,
        Namespace
=http://mynamespaces.com/TestService<SPAN style="COLOR:

Finally some bits!

Finally some bits!

I’ve been teasing for a while about my Atlas-base Windows Workflow designer for a
while.  Its just that although I had some basic functionality working months
ago – it has taken me this long with all the other consulting and training I’ve been
doing to actually get things working to what I consider a beta level.

So with this post I am announcing beta 1 of the Atlas Workflow Designer.  I am
putting up source code – but I am releasing it under the MIT license (which basically
means you can use it for any purpose – even commercial – you just have to leave my
copyright notice in it so I get credit :)).

Any bug reports are welcome – although code reviews are not ;-).  Personally
I am happy with the functionality – I am not necessarily happy with the way all
the code is factored.  Some of it to be perfectly honest is a total hack. 
Mostly in the Atlas based “class” that runs the designer in the browser.  There
is some serious refactoring that needs to get done there, which I will be working
on for future releases.  Also – the persistence layer (saving the xaml and rules
to the database) isn’t as layered as I’d like (I have plans for a workflow persistence
provider so different stores can be easily plugged in).  Also the coupling between
the javascript and the service is a little tight – but that may be unavoidable in
this particular application.

The biggest thing to get working better is the property grid and rules.  As of
now – all you can put in for rules is “true” (yes – I know this sucks – but making
a near full-featured rule editor in the browser is another big task).  
There also may be some other property types that cause trouble –  but I think
that is mostly taken care of.  

You can put bug reports here or email them to me – but remember – I am giving this
code away essentially – I am not charging you for it ;-).  But – if you are someone
in need of consulting with WF (whether with designers or any other issues) please
drop me a line 🙂

I’ll try to post a camtasia of myself using it later so you can get a handle on how
it works – plus there is a slightly weird issue in Mozilla (where you can drop the
activities is pretty funky right now – but pretty much everything else works). 
You’ll need SQLExpress installed to get the persistence layer to work correctly (or
import the mdf into SQLServer and change the connection string in the web.config). 

Anyway – enjoy – hopefully this will be useful.

AtlasWorkflowDesigner.zip
(947.94 KB)

Line of Business Adapter Documentation

I am very interested in anyone doing any work with the Microsoft Line of Business (LOB) adapters.  This includes the following.




  • PeopleSoft


  • JD Edwards OneWorldXE


  • JD Edwards Enterprise1


  • Oracle Application Suite


  • Oracle Database Connector


  • Siebel


  • TIBCO Rendezvous


  • TIBCO EMS  

Specifically, what is not in the documentation and what possible samples would be helpful? Also, we are working on an LOB FAQ and soliciting any questions you may have regarding LOB adapters.  If you find any  bugs in the documentation send them my way as well!


Thanks!