Skip to content

Commit

Permalink
UHF-10559: Updated documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
tuutti committed Sep 3, 2024
1 parent 1ffd027 commit 04724ee
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 32 deletions.
32 changes: 3 additions & 29 deletions documentation/pubsub-messaging.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ Provides an integration to [Azure's Web PubSub service](https://azure.microsoft.

## Configuration

You must define a [JSON Vault item](/documentation/api-accounts.md#managing-external-api-credentials) to use this feature. The data field should be a JSON string containing `endpoint`, `hub`, `group` and `access_key`:
You must define a [JSON Vault item](/documentation/api-accounts.md#managing-external-api-credentials) to use this feature. The data field should be a JSON string containing `endpoint`, `hub`, `group` and `access_key` and optional `secondary_access_key`:

```json
{"endpoint": "<endpoint>", "hub": "<hub>", "group": "<group>", "access_key": "<access-key>"}
{"endpoint": "<endpoint>", "hub": "<hub>", "group": "<group>", "access_key": "<access-key>", "secondary_access_key": "<secondary-access-key>"}
```

## Usage
Expand Down Expand Up @@ -85,34 +85,8 @@ $pubsub_account = [
'hub' => '<hub>',
'group' => '<group>',
'access_key' => '<access-key>',
'secondary_access_key' => '<secondary-access-key>',
]),
];
$config['helfi_api_base.api_accounts']['vault'][] = $pubsub_account;
```

## Solving pubsub related problems

If menus or news or other content doesn't update normally, you can verify that the pubsub service is working correctly

### Artemis is not up on etusivu-instance
- See that frontpage production has artemis pod up and running

#### If the pod is not running
- See if there is a pipeline to get it up again OR
- Contact HiQ


### Pubsub-process is not running
- Go to any production site's cron pod
- run `ps aux`, you should see pubsub related process on the list

#### If the process is not running
- Short term solution is to run `drush cr` to force the site to fetch new data.
- You can run production deployment to get it running again.


### Bad credentials
- Go to any cron pod and look for authorization error

#### Update the credentials
- Go and update the pubsub-vault credentials
6 changes: 3 additions & 3 deletions src/Drush/Commands/PubSubCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ final class PubSubCommands extends DrushCommands {
/**
* Constructs a new instance.
*
* @param \Drupal\helfi_api_base\Azure\PubSub\PubSubManagerInterface $clientManager
* @param \Drupal\helfi_api_base\Azure\PubSub\PubSubManagerInterface $pubSubManager
* The PubSub client.
*/
public function __construct(
private readonly PubSubManagerInterface $clientManager,
private readonly PubSubManagerInterface $pubSubManager,
) {
parent::__construct();
}
Expand All @@ -47,7 +47,7 @@ public function __construct(
public function listen() : int {
for ($received = 0; $received < self::MAX_MESSAGES; $received++) {
try {
$message = $this->clientManager->receive();
$message = $this->pubSubManager->receive();
$this->io()
->writeln(sprintf('Received message [#%d]: %s', $received, $message));
}
Expand Down

0 comments on commit 04724ee

Please sign in to comment.