Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Building Serverless Architectures

You're reading from   Building Serverless Architectures Unleash the power of AWS Lambdas for your applications

Arrow left icon
Product type Paperback
Published in Jul 2017
Publisher Packt
ISBN-13 9781787129191
Length 242 pages
Edition 1st Edition
Languages
Tools
Concepts
Arrow right icon
Author (1):
Arrow left icon
Cagatay Gurturk Cagatay Gurturk
Author Profile Icon Cagatay Gurturk
Cagatay Gurturk
Arrow right icon
View More author details
Toc

Lambda function for updating search data

Now, we will create another Lambda function that reads the SNS notification and writes the value to CloudSearch. Unfortunately, at this stage, we need to refactor our code a bit because as you remember, we were publishing only the email addresses of the newly registered users to the SNS. We now need to change the user registration Lambda to emit the user data as a JSON value.

To accomplish this, let's first modify our User object in User Service with Jackson annotations to have a correct serialization to JSON.

Change the com.serverlessbook.services.user.domain.User class and add the following the @JsonProperty annotations to all properties:

@DynamoDBHashKey(attributeName = "UserId") 
@JsonProperty("userid") 
private String id; 
 
@DynamoDBIndexHashKey(globalSecondaryIndexName = 
"UsernameIndex", attributeName...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime