如何向Actor Application添加监听器?

时间:2016-12-13 13:23:11

标签: azure azure-service-fabric

我使用以下代码在actor中调用无状态服务:

要解决这个问题,我们必须添加听众The primary or stateless instance for the partition has invalid address

但是这个方法(CreateServiceReplicaListeners)vis不可用于覆盖从Actor注册远程。

当我们想要从演员到服务进行远程调用时,如何做到这一点?

1 个答案:

答案 0 :(得分:1)

1.将此添加到无状态服务代码,喜欢描述     here

<div class="dependents-covered-elsewhere">
  <span class="dependents-covered-elsewhere-asterisk">*</span>
  <label data-bind="text: i18n('dependents.coveredElsewhere')">Is the dependent covered elsewhere?</label>
  <input type="radio" name="coveredElsewhere" value="1" data-bind="checked: coveredElsewhereForBinding, enable: !(isTab() &amp;&amp; emprel_id &amp;&amp; vm.home.action() == 'life-events')" disabled="">
  <div data-bind="visible: field.isModified() &amp;&amp; !field.isValid(), attr: {title: field.error}" class="info" style="display: none;">
  </div>

  <label>
    <!-- ko i18n:'yes' -->Yes
    <!-- /ko -->
  </label>

  <input type="radio" name="coveredElsewhere" value="0" data-bind="checked: coveredElsewhereForBinding, enable: !(isTab() &amp;&amp; emprel_id &amp;&amp; vm.home.action() == 'life-events')" disabled="">
  <div data-bind="visible: field.isModified() &amp;&amp; !field.isValid(), attr: {title: field.error}" class="info" style="display: none;">
  </div>


  <label>
    <!-- ko i18n:'no' -->No
    <!-- /ko -->
  </label>
</div>

2.在 Actor 中,按以下方式调用服务:

protected override IEnumerable<ServiceInstanceListener> CreateServiceInstanceListeners()
{
    return new[] { new ServiceInstanceListener(context => 
        this.CreateServiceRemotingListener(context)) };
}