# CamundaLibrary 1.1: One library for all and long polling

**URL:** <https://forum.robotframework.org/t/camundalibrary-1-1-one-library-for-all-and-long-polling/1336>\
**Category:** BPMN\
**Created:** [15 February 2021 19:07 UTC](https://forum.robotframework.org/t/camundalibrary-1-1-one-library-for-all-and-long-polling/1336 "2021-02-15T19:07:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Noordsestern](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/noordsestern/32/4270_2.png) [@Noordsestern](https://forum.robotframework.org/u/Noordsestern)\
**Post date:** [15 February 2021 19:07 UTC](https://forum.robotframework.org/t/camundalibrary-1-1-one-library-for-all-and-long-polling/1336/1 "2021-02-15T19:07:04Z")

</div>

CamundaLibrary 1.0 and 1.1 are released.

# 1.0 Version: one library for all

Previously we had `CamundaLibrary.ExternalTask` and `CamundaLibrary.Deployment` and so on as sub libraries. That was very inconvenient. Only to experts it might have been obvious that the structure of sub libraries was equivilant to the Camunda REST API documentation. Even we often got confused, if we had to use for starting a process instance the sub library `ProcessDefinition` or `ProcessInstance`. Don’t bother anymore: The sub libraries are gone and there is only **CamundaLibrary** :

```python
***Settings***
Library CamundaLibrary http://localhost:8080

***Task***
Demo task
    # former: CamundaLibrary.Deployment
    deploy model from file bpmn/demo_process.bpmn

    # former: CamundaLibrary.ProcessDefinition
    start process demo_process

    # former: CamundaLibrary.ExternalTask
    ${variables} fetch workload my_topic
    do some processing
    complete task

```

Also some keywords got deprecated throwing warnings.

# 1.1 Long polling

Since tasks have individual processing durations some might end too soon, while there predecessor are still busy.

Assume this:

```python
***Task***
Slow task 1
    fetch workload my_topic1
    sleep 2s
    complete task

Super fast task 2
    fetch workload my_topic2
    # complete task immediately
    complete task

```

Because second task finishs immediately, it won’t catch any workload from task 1 until task 2 is restarted.

With [long polling](https://docs.camunda.org/manual/latest/user-guide/process-engine/external-tasks/#long-polling-to-fetch-and-lock-external-tasks) you can now tell a `fetch workload` keyword to negotiate a timeout (in milliseconds). If a workout does arrive within timeout at the camunda acitivity, Camunda calls back the robot client delievering the new workload. Long polling is activated with `àsync_response_timeout` setting the timeout in milliseconds (30 minutes maximum):

```python
***Task***
Slow task 1
    fetch workload my_topic1
    sleep 2s
    complete task

Super fast task 2 waiting for task1
    # wait up to 3000 milliseconds for new workload passed on by task1
    fetch workload my_topic2 async_response_timeout=3000
    # complete task immediately
    complete task

```

Enjoy.
