This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Recieve message from Amazon SQS Queue | |
* */ | |
@JmsListener(destination = '${amazon.sqs.queue}') | |
void listenSyncManager(String requestString) { | |
log.info "Received from SQS: $requestString" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def defaultJmsTemplate | |
/* | |
* Send message to Amazon SQS Queue | |
* */ | |
void sendMessage(String queueName, String payload) { | |
log.debug "Send message to SQS, queue:$queueName, message:$payload" | |
defaultJmsTemplate.convertAndSend(queueName, payload) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ComponentScan("grails.aws.sqs.example.config") | |
class Application extends GrailsAutoConfiguration { | |
static void main(String[] args) { | |
GrailsApp.run(Application, args) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package grails.aws.sqs.example.config | |
import com.amazon.sqs.javamessaging.ProviderConfiguration | |
import com.amazon.sqs.javamessaging.SQSConnectionFactory | |
import com.amazonaws.auth.AWSCredentials | |
import com.amazonaws.auth.AWSStaticCredentialsProvider | |
import com.amazonaws.regions.Regions | |
import com.amazonaws.services.sqs.AmazonSQSClientBuilder | |
import grails.util.Holders | |
import org.springframework.context.annotation.Bean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//AWS SDK for Java | |
compile 'com.amazonaws:aws-java-sdk:1.11.228' | |
//Spring JMS implementation | |
compile 'org.springframework:spring-jms' | |
//Amazon SQS Client Libraries for JMS | |
compile 'com.amazonaws:amazon-sqs-java-messaging-lib:1.0.4' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
amazon: | |
key: IAM-user-key | |
secret: IAM-user-secret | |
sqs: | |
queue: SQS-queue-name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package test | |
import com.illerax.randominit.RandomInit | |
class RandomInitTest extends GroovyTestCase { | |
void testRandomInitAnnotation() { | |
@RandomInit def exp | |
assert exp == null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.illerax.randominit | |
import org.codehaus.groovy.transform.GroovyASTTransformationClass | |
import java.lang.annotation.ElementType | |
import java.lang.annotation.Retention | |
import java.lang.annotation.RetentionPolicy | |
import java.lang.annotation.Target | |
@Target([ElementType.LOCAL_VARIABLE]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.illerax.randominit | |
import org.codehaus.groovy.ast.ASTNode | |
import org.codehaus.groovy.ast.expr.ConstantExpression | |
import org.codehaus.groovy.control.CompilePhase | |
import org.codehaus.groovy.control.SourceUnit | |
import org.codehaus.groovy.transform.ASTTransformation | |
import org.codehaus.groovy.transform.GroovyASTTransformation | |
/** |