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...