0

我尝试了以下方法将 TaskQueue 传递给后端,但没有奏效。

这种语法有问题吗?

try{
    Queue queue = QueueFactory.getQueue("pine");
    TaskOptions options = TaskOptions.Builder.withUrl("/pine/task/getbusy");

    options = options.param("taskparams", params);
    options = options.header("Host",
    BackendServiceFactory.getBackendService().getBackendAddress("pinetask", 1));

    queue.add(options);
}

后端.xml:

<backends>
  <backend name="pinetask">
    <class>B2</class>
    <instances>1</instances>
    <max-concurrent-requests>1</max-concurrent-requests>
    <options>
      <public>false</public>
      <dynamic>true</dynamic>
    </options>
  </backend>
</backends>
4

2 回答 2

2

因为实例 1 意味着索引 0 ?

于 2011-08-05T06:57:53.227 回答
0

试试这个“主机”标题:

options = options.header("Host", BackendServiceFactory.getBackendService().getBackendAddress("pinetask"));

于 2013-08-31T05:50:54.297 回答