Skip to content

Commit

Permalink
Some basic stdout logs for what is happening when ingesting SQS messages
Browse files Browse the repository at this point in the history
  • Loading branch information
giorgiosironi committed Dec 1, 2016
1 parent 3843e47 commit 7e47fda
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ function drush_jcms_notifications_article_import($lrp = FALSE) {
$count = 0;
while (TRUE) {
$message = $queue_service->getMessage();
drush_print(dt('Received message !message', ['!message' => var_export($message, true)]));
// If this isn't a long running process and the message is null.
if ($message === NULL && !$lrp) {
break;
Expand All @@ -44,7 +45,9 @@ function drush_jcms_notifications_article_import($lrp = FALSE) {
if ($id) {
$article = $fetch_service->getArticle($id);
$crud_service->crudArticle($article);
drush_print(dt('Processed message !message_id', ['!message_id' => $message->getMessageId()]));
$queue_service->deleteMessage($message);
drush_print(dt('Deleted from the queue message !message_id', ['!message_id' => $message->getMessageId()]));
$count++;
}
}
Expand Down
11 changes: 9 additions & 2 deletions src/modules/jcms_notifications/src/Queue/SqsMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,21 @@ public function __construct(string $messageId, string $id, string $type, string
}

/**
* Id or Number.
* Identifier for the SQS message
*/
public function getMessageId() : string {
return $this->messageId;
}

/**
* Id or Number identifying the single entity the notification is related to.
*/
public function getId() : string {
return $this->id;
}

/**
* Type (Article, Collection, Event etc.).
* Type ('article', 'collection', 'event', etc.).
*/
public function getType() : string {
return $this->type;
Expand Down

0 comments on commit 7e47fda

Please sign in to comment.