# IMQService.(constructor) · @imqueue/rpc

Source: https://imqueue.org/api/rpc/latest/rpc.imqservice._constructor_/
Published: 2026-08-04
Author: @imqueue maintainers (https://github.com/imqueue)
Package: @imqueue/rpc 3.5.3 — generated reference, not hand-written

Constructs a service.

**Signature:**

```typescript
constructor(options?: Partial<IMQServiceOptions>, name?: string);
```

## Parameters


| Parameter | Type | Description |
| --- | --- | --- |
| options | Partial<[IMQServiceOptions](https://imqueue.org/api/rpc/latest/rpc.imqserviceoptions/)> | _(Optional)_ service options, shallow-merged over [DEFAULT\_IMQ\_SERVICE\_OPTIONS](https://imqueue.org/api/rpc/latest/rpc.default_imq_service_options/), except `metricsServer` which is merged separately over [DEFAULT\_IMQ\_METRICS\_SERVER\_OPTIONS](https://imqueue.org/api/rpc/latest/rpc.default_imq_metrics_server_options/) |
| name | string | _(Optional)_ overrides the class name as the service/queue name, and as the description cache key |


## Exceptions

TypeError when [IMQService](https://imqueue.org/api/rpc/latest/rpc.imqservice/) is instantiated directly. Note the check is by resolved name, so passing `'IMQService'` as the `name` of a subclass throws as well.

## Remarks

Constructing a service installs process signal handlers for `SIGTERM`, `SIGINT`, `SIGHUP` and `SIGQUIT`. On any of them the service tears the queue down, closes the metrics server, and then force-exits with code 0 after `IMQ_SHUTDOWN_TIMEOUT` — a fixed timer, not a drain: requests still being processed are not awaited.

The merged options are passed straight to the queue factory, so `vendor` and `cluster`/`clusterManagers` select the transport implementation.

