---
title: Message service pool
slug: cms-11/dev-docs/message-service-pool
docTags: 
createdAt: 2026-07-22T19:45:21.284Z
---

The message service alerts an editor of the current working page status, such as when an editor edits a page property or submits a page for editing.

The message service store uses a central message pool with two main parts:

- A **central message hub service** that supports other parts in adding or removing items.
- A **widget container** that displays the notification items for a current working page to a user.

## Adding message service component

The message service is the central hub registered in the Optimizely Framework ShellModule.

To refer to the message service, use a dependency to resolve it.

```shell
this._messagePool = epi.dependency.resolve("epi.shell.MessageService");
```

## Methods

```shell
put: function ( /*String*/typeName,
                /*String*/message,
                /*String*/contextTypeName,
                /*Object*/contextId,
                /*Object*/externalItemId,
                /*Object*/externalItemData) 
    
remove: function (/*Object?*/query)

query: function (/*Object?*/query)

observe: function (/*Object?*/query, callback)
```

## Examples

### Add a page property to the message queue

The following example code shows how to add a `page` property item error to the global message queue.

```shell
this._messagePool.put("error", result.error, "Page", this.pageLink, item.propertyName, item.item);
```

### Remove a page property from the message queue

The following example code shows how to remove a `page` property item error from the global message queue.

```shell
this._messagePool.remove({
    contextTypeName: "Page",
    contextId: this.pageLink,
    externalItemId: item.propertyName,
    externalItemData: item.item });
```

### Query error items in the message queue

The following example code shows how to query error items with a specific `contextTypeName` and `contextId` in the global message queue.

```shell
this._query = { typeName: "error", contextTypeName: this.contextTypeName, contextId: this.contextId};
var messages = this._messagePool.query(this._query);
```

### Observe a message in the message queue

The following example code shows how to observe a message with a specific `contextTypeName` and `contextId` in the global message queue, with query conditions.

```shell
this._messagePool.observe({ contextTypeName: messageContext.contextTypeName, contextId: messageContext.contextId });
```

## Message service listener widget

Currently, the **\[NotificationStatusBar]** widget is injected into the status bar and observes changes in the message queue related to the current working page. The widget then displays message elements for the current working page, such as errors, warnings, and notifications.
