2011-11-06 15 views
6

मेरे पास एक कस्टम ट्रैकिंग सेवा है जो 1500 से अधिक लाइव वर्कफ़्लो के साथ टिक रहा है, अब मैं वर्कफ़्लो को संस्करणित करने की प्रक्रिया में हूं ताकि मैं कुछ परिवर्तन अनुरोध जारी कर सकूं।डब्ल्यूएफ कस्टम एसक्यूएल ट्रैकिंग सेवा पुराने वर्कफ़्लो के लिए काम करना बंद कर दिया?

दुर्भाग्यवश सिस्टम को प्रारंभिक रूप से दृढ़ता से टाइप की गई असेंबली के साथ तैनात नहीं किया गया था, इसलिए मैं इस गड़बड़ी को हल करने की प्रक्रिया में हूं।

मैं अब दृढ़ता से टाइप किया विधानसभाओं के लिए मेजबान का कहना है मदद करने के लिए PublicKeyToken = मेरी नई PublicKeyToken को अशक्त, और एक AppDomain_AssemblyResolve प्रतिनिधि अनुवाद करने के लिए एक कस्टम SerializationBinder के मिश्रण का उपयोग करने के लिए कर रहा हूँ - Referenced here

मैं भी, [प्रकार] तालिका कि डिफ़ॉल्ट SqlTrackingService के साथ आता है के संदर्भ के लिए नई PublicKeyToken भीतर संबंधित पंक्तियों की सामग्री को बदलने के लिया है तो:

some.namespace.foobar, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 

साथ बदल दिया है:

some.namespace.foobar, Version=1.0.0.0, Culture=neutral, PublicKeyToken=123456789acb 

मुझे अच्छी प्रगति हो रही थी, हालांकि जब मैं अपनी स्टेट मशीन वर्कफ़्लो को बदलता हूं, तो कस्टम ट्रैकिंग सेवा जिसे मैंने सेवा के रूप में जोड़ा है, अब संस्करण 1.0.0.0 वर्कफ़्लो के लिए फायरिंग नहीं कर रहा है, लेकिन नव निर्मित के लिए काम कर रहा है संस्करण 2.0.0.0 वर्कफ़्लोज़।

नोट: डिफ़ॉल्ट SqlTrackingService अभी भी वर्कफ़्लो के दोनों संस्करणों पर ठीक चल रहा है, यह केवल मौजूदा वर्कफ़्लो पर कस्टम ट्रैकिंग सेवा के साथ एक समस्या है।

कस्टम ट्रैकिंग सेवा हमेशा इस तरह app.config के माध्यम से जोड़ा गया है:

<Services> 
     ...other services here... 
     <add type="some.namespace.ActiveStateTrackingService, some.namespace.extensions" assembly="uk.gov.gsi.cma.extensions" /> 
</Services> 

मैं और क्या पहले से ही विद्यमान workflows के लिए इस काम के प्राप्त करने के लिए बदलने की जरूरत है पर कोई भी विचार?

अनुरोध के रूप में, यहां कस्टम ट्रैकिंग सेवा है, हालांकि कस्टम ट्रैकिंग सेवा को "बाध्यकारी" होस्ट के साथ समस्या करना है, न कि ट्रैकिंग सेवा स्वयं - मुझे यह पता है क्योंकि उदाहरण में कस्टम ट्रैकिंग सेवा नहीं है 'नहीं निकाल दिया गया, कन्स्ट्रक्टर समेत किसी भी तरीके को बुलाया नहीं जाता है।

public class ActiveStateTrackingService : TrackingService 
{ 
    protected override TrackingProfile GetProfile(Guid workflowInstanceId) 
    { 
     return GetDefaultProfile(); 
    } 

    protected override TrackingProfile GetProfile(Type workflowType, Version profileVersionId) 
    { 
     return GetDefaultProfile(); 
    } 

    protected override TrackingChannel GetTrackingChannel(TrackingParameters parameters) 
    { 
     return new ActiveStateTrackingChannel(parameters); 
    } 

    protected override bool TryGetProfile(Type workflowType, out TrackingProfile profile) 
    { 
     profile = GetDefaultProfile(); 
     return true; 
    } 

    protected override bool TryReloadProfile(Type workflowType, Guid workflowInstanceId, out TrackingProfile profile) 
    { 
     profile = null; 
     return false; 
    } 

    private TrackingProfile GetDefaultProfile() 
    { 
     TrackingProfile profile = new TrackingProfile(); 
     profile.Version = new Version(1, 0); 

     // Add tracking point for state activity executing 
     ActivityTrackPoint statePoint = new ActivityTrackPoint(); 
     ActivityTrackingLocation location = new ActivityTrackingLocation(typeof(StateActivity), new ActivityExecutionStatus[] { ActivityExecutionStatus.Executing }); 
     statePoint.MatchingLocations.Add(location); 
     profile.ActivityTrackPoints.Add(statePoint); 

     return profile; 
    } 
} 

public class ActiveStateTrackingChannel : TrackingChannel 
{ 

    private TrackingParameters param; 

    public ActiveStateTrackingChannel(TrackingParameters parameters) 
    { 
     param = parameters; 
    } 

    protected override void InstanceCompletedOrTerminated() 
    { 
     return; 
    } 

    protected override void Send(TrackingRecord record) 
    { 

     // get the tracking record and write out the name of the state. 
     var r = record as ActivityTrackingRecord; 

     if (r != null) 
      if (!string.IsNullOrEmpty(r.QualifiedName)) 
      { 
       using (ICaseService caseService = new CaseService()) 
        { 
         SomeServiceLayer.UpdateCurrentStateOutsideOfTheWorkflow(param.ContextGuid, r.ParentContextGuid, r.QualifiedName); 
         Console.WriteLine("*** Current State: {0} ***", r.QualifiedName); 
        } 
      }      
    } 
} 
+0

'असेंबली' टैग निम्न स्तर के प्रोग्रामिंग के लिए है, न कि .NET असेंबली के लिए। – harold

+0

धन्यवाद, टाइपो को सही किया। – Tr1stan

+0

अपनी कस्टम ट्रैकिंग सेवा को देखे बिना बताना मुश्किल है। –

उत्तर

0

यह पता चला है कि अंतिम चरण एक आसान है। यह मुद्दा डब्ल्यूएफ और microsoft have outlined the answer here में एक बग है।

आप मूल रूप से एक विशेषता है जो आप पुराने ट्रैकिंग सेवा संदर्भ है, तो तरह हल करने के लिए अनुमति देता है के साथ अपने कस्टम ट्रैकिंग सेवा वर्ग को सजाने के लिए है:

[System.Workflow.Runtime.Tracking.PreviousTrackingService("myNamespace.Workflow.StateMachineTrackingService, myNamespace.Workflow.StateMachineTracking, Version=1.2.0.1, Culture=neutral, PublicKeyToken=gr4b2191f58h9e0d")] 
public class StateMachineTrackingService : TrackingService 
     { 
     //Body of your custom tracking service here 
     } 

कम और निहारना, मेरे पहले से कायम workflows अब नया संस्करण हल ट्रैकिंग सेवा का।

संबंधित मुद्दे