# Worker service

A worker or worker service is a service that hosts the workflow and activity implementations. The worker polls the Cadence service for tasks, performs those tasks, and communicates task execution results back to the Cadence service. Worker services are developed, deployed, and operated by Cadence customers.

You can run a Cadence worker in a new or an existing service. Use the framework APIs to start the Cadence worker and link in all activity and workflow implementations that you require the service to execute.

Worker.Factory factory = new Worker.Factory(DOMAIN,
            new Worker.FactoryOptions.Builder()
    Worker worker = factory.newWorker(TASK_LIST,
            new WorkerOptions.Builder()
    // Workflows are stateful. So you need a type to create instances.
    // Activities are stateless and thread safe. So a shared instance is used.
    worker.registerActivitiesImplementations(new GreetingActivitiesImpl());
    // Start listening to the workflow and activity task lists.

The WorkerFactoryOptions (opens new window) includes those that need to be shared across workers on the hosts like thread pool, sticky cache.

In WorkerOptions (opens new window) you can customize things like pollerOptions, activities per second.