Re: BizTalk 2004 :: Fact retriever :: more than 1 data connection?
- From: "BlueDolphin" <BlueDolphin@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 31 May 2005 03:11:03 -0700
Hello Matt,
I tried executing the assert statement twice so that my rules policy can go
to different tables in the database to grab the data, but I encountered the
error:
Microsoft.RuleEngine.PolicyExecutionException: An exception occurred inside
the rule engine instance executing policy
"EMRXServiceInterchangeEngineRulesPolicy". --->
Microsoft.RuleEngine.RuleEngineArgumentNullException: The value of argument
"newXml" cannot be null.
at Microsoft.RuleEngine.Rete.Rete.ProcessException(Exception ex)
at Microsoft.RuleEngine.Rete.Rete.ExecuteInternal(Object facts, Object
data)
at Microsoft.RuleEngine.Rete.Rete.ProcessingLoop(Operation operation,
Object facts, Object data, EngineState nextState)
at Microsoft.RuleEngine.Rete.Rete.Execute(Object facts)
at Microsoft.RuleEngine.Policy.ExecuteInternal(Object facts)
--- End of inner exception stack trace ---
at Microsoft.RuleEngine.Policy.ExecuteInternal(Object facts)
at Microsoft.RuleEngine.Policy.Execute(Object facts)
at Microsoft.RuleEngine.Policy.Execute(Object[] facts)
at
EMRX.Orchestration.ServiceInterchangeEngine.EMRXServiceInterchangeOrchestration.segment3(StopConditions stopOn)
at Microsoft.XLANGs.Core.SegmentScheduler.RunASegment(Segment s,
StopConditions stopCond, Exception& exp)
Microsoft.RuleEngine.PolicyExecutionException
Below is the updatefact method that I try to simulate what you've mentioned.
public object UpdateFacts (RuleSetInfo ruleSetInfo, RuleEngine engine,
object factsHndlIn)
{
object factsHndlOut = null;
// The following logic asserts the required DB rows only once.
// The initial values (cached during the first retrieval) are returned in
subsequent execution cycles
if (factsHndlIn == null)
{
SqlConnection con1;
DataConnection dc1, dc2;
con1 = new SqlConnection( "Data Source=(local);Initial
Catalog=EMRX;UID=sa;Pwd=pass@word1;");
dc1 = new DataConnection( "EMRX", "PublishedServicesList", con1);
engine.Assert( dc1);
dc2 = new DataConnection( "EMRX", "ServicesSubscription", con1);
engine.Assert( dc2);
factsHndlOut = dc2;
}
else
{
factsHndlOut = factsHndlIn;
}
return factsHndlOut;
}
But if I remove away the two lines
dc2 = new DataConnection( "EMRX", "ServicesSubscription", con1);
engine.Assert( dc2);
the policy would runs properly.
Appreciate if you could enlighten me on the missing link.
I'm new to BizTalk, any help is greatly appreciated.
Thanks.
Regards,
Desmond
"Matt Milner" wrote:
> Simply create and assert more than one dataconnection. If you are using the
> same database, you can reuse the SqlConnection like so:
>
> DataConnection dc1 =
> > new DataConnection("foo", "fum", con1);
> > Dataconnection dc2 = new DataConnection("bar", "bum", con1);
> > engine.Assert(dc1);
> engine.Assert(dc2);
>
> It is not the return value that gets entered intot the engine for execution,
> the factsHandleOut is your handle to know whether to refresh the facts. This
> is a little confusing, I know and it is a shame that most samples show the
> connection being handed back.
>
> You can also create another sql connection, wrap it with the second data
> connection and assert that. Similarly, if you are asserting
> datatable/datarow facts, you can use the sql connection to retrieve those
> and assert them.
>
> Matt
>
>
>
> "BA" <biztalk.architect@xxxxxxxxx> wrote in message
> news:1116329399.521056.291710@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> > Hello,
> >
> > In the code below you set a single data connection for a single DB
> > table.
> >
> > I have many data connections to add, how do you extend this sample to
> > add more than 1 data connection?
> > public class DbFactRetriever : IFactRetriever
> > {
> >
> > public object UpdateFacts(RuleSetInfo rulesetInfo,
> > Microsoft.RuleEngine.RuleEngine engine,
> > object factsHandleIn)
> >
> > {
> > object factsHandleOut;
> >
> > SqlConnection con1 = new
> > SqlConnection("Initial Catalog=foo;
> > Data Source=(local);Integrated Security=SSPI;");
> >
> > DataConnection dc1 =
> > new DataConnection("foo", "fum", con1);
> >
> > engine.Assert(dc1);
> > factsHandleOut = dc1;
> > }
> > return factsHandleOut;
> > }
> >
> >
> > I'm still learning C# so any help would be greatly appreciated.
> >
> > Thanks!
> >
> > BA
> >
>
>
>
.
- References:
- Prev by Date: Rules engine doesn't see updated value
- Next by Date: BizTalk 2004 Rule Engine Fact Retriever Problem
- Previous by thread: Re: BizTalk 2004 :: Fact retriever :: more than 1 data connection? How?
- Next by thread: Using WMI tables how to get the sendport of a particular orchestra
- Index(es):
Relevant Pages
|