usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sfeld...@apache.org
Subject [3/6] incubator-usergrid git commit: Add async handler to SNSAsyncClient so we can log successes in debug and, more importantly, always log errors.
Date Thu, 02 Jul 2015 19:28:58 GMT
Add async handler to SNSAsyncClient so we can log successes in debug and, more importantly,
always log errors.


Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/d29756a6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/d29756a6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/d29756a6

Branch: refs/heads/two-dot-o-dev
Commit: d29756a6f3e00f3b4e792fe1f15a4c5d7e757b35
Parents: ddeb700
Author: Michael Russo <michaelarusso@gmail.com>
Authored: Thu Jul 2 09:24:58 2015 -0700
Committer: Michael Russo <michaelarusso@gmail.com>
Committed: Thu Jul 2 09:24:58 2015 -0700

----------------------------------------------------------------------
 .../persistence/queue/impl/SNSQueueManagerImpl.java   | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/d29756a6/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/impl/SNSQueueManagerImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/impl/SNSQueueManagerImpl.java
b/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/impl/SNSQueueManagerImpl.java
index 12e04ce..6c6cae9 100644
--- a/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/impl/SNSQueueManagerImpl.java
+++ b/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/queue/impl/SNSQueueManagerImpl.java
@@ -19,6 +19,7 @@ package org.apache.usergrid.persistence.queue.impl;
 
 
 import com.amazonaws.AmazonServiceException;
+import com.amazonaws.handlers.AsyncHandler;
 import com.amazonaws.regions.Region;
 import com.amazonaws.regions.Regions;
 import com.amazonaws.services.sns.AmazonSNSAsyncClient;
@@ -365,9 +366,18 @@ public class SNSQueueManagerImpl implements QueueManager {
 
         PublishRequest publishRequest = new PublishRequest(topicArn, toString(body));
 
-        sns.publishAsync(publishRequest);
+        sns.publishAsync(publishRequest, new AsyncHandler<PublishRequest, PublishResult>()
{
+                @Override
+                public void onError(Exception e) {
+                    logger.error("Error publishing message... {}", e);
+                }
+
+                @Override
+                public void onSuccess(PublishRequest request, PublishResult result) {
+                    if (logger.isDebugEnabled()) logger.debug("Successfully published...
messageID=[{}],  arn=[{}]", result.getMessageId(), request.getTopicArn());
 
-        // see about implementing asyncHandler for publishAsync in future
+                }
+            });
 
     }
 


Mime
View raw message