/// <summary> /// Scans the target object passed for dispatchable methods and adds /// them to the dispatcher, using the <see cref="IDynamicEPMunger" /> /// instance passed to dynamically modify endpoints for message handlers /// marked with <c>[MsgHandler(DynamicScope="scope-name")]</c>. /// </summary> /// <param name="target">The object to be scanned.</param> /// <param name="dynamicScope">Specifies the dynamic scope name for the message handlers to be processed (or <c>null</c>).</param> /// <param name="munger">The dynamic endpoint munger (or <c>null</c>).</param> /// <param name="targetGroup">Optional dispatch target grouping instance (or <c>null</c>).</param> /// <remarks> /// <para> /// Calling this method will result in the GUID being updated and /// then call the associated router's <see cref="MsgRouter.OnLogicalEndpointSetChange"/> /// method. /// </para> /// <para> /// The <paramref name="targetGroup" /> parameter can be used to group /// together message dispatch handlers implemented by a different /// target object instances. This functionality is important when /// the impleentation of message type specific handlers is spread /// across multiple target classes. /// </para> /// <para> /// An example of this use is how the <see cref="ClusterMember" /> /// class' <see cref="ClusterMember.AddTarget" /> method to group the /// new target's message handler with the <see cref="ClusterMember" /> /// handlers since they'll share the same logical endpoint. /// </para> /// <para> /// If <paramref name="targetGroup" /> is passed as <c>null</c> then /// separate routes will be maintained for each target instance resulting /// in messages be load balanced randomly across the instances. /// </para> /// </remarks> public void AddTarget(object target, string dynamicScope, IDynamicEPMunger munger, object targetGroup) { if (dynamicScope == null || munger == null) { AddTarget(target, new ScopeMunger[0], targetGroup); } else { AddTarget(target, new ScopeMunger[] { new ScopeMunger(dynamicScope, munger) }, targetGroup); } }
/// <summary> /// Constructor. /// </summary> /// <param name="dynamicScope">The dynamic scope name.</param> /// <param name="munger">The associated <see cref="IDynamicEPMunger" /> implementation.</param> public ScopeMunger(string dynamicScope, IDynamicEPMunger munger) { this.DynamicScope = dynamicScope; this.Munger = munger; }