public static void main()

in src/main/java/software/amazon/sqs/sample/SendMessageWithAttributes_AWSXRay_Tracing_FIFO.java [24:55]


	public static void main(String[] args) {
		// TODO: update the value of queueUrl with the URL of FIFO queue you create
		// in your AWS account
		String queueUrl = "https://sqs.us-east-1.amazonaws.com/1234567890/sqs_queue_demo_fifo.fifo";
		AWSXRay.beginSegment("Sqs-FIFO");
		SqsClient sqsClient = SqsClient.builder().region(Region.US_EAST_1)
				.overrideConfiguration(
						ClientOverrideConfiguration.builder().addExecutionInterceptor(new TracingInterceptor()).build())
				.build();

		Map<String, MessageAttributeValue> messageAttributes = new HashMap<String, MessageAttributeValue>();
		messageAttributes.put("message_attribute_string_type",
				MessageAttributeValue.builder().dataType("String").stringValue("string_value").build());
		messageAttributes.put("message_attribute_number_type",
				MessageAttributeValue.builder().dataType("Number").stringValue("123").build());
		SdkBytes binaryValue = SdkBytes.fromString("my_binary_value", Charset.defaultCharset());
		messageAttributes.put("message_attribute_binary_type",
				MessageAttributeValue.builder().dataType("Binary").binaryValue(binaryValue).build());

		SendMessageResponse sendMessageResponse = null;

		for (int i = 1000; i < 1010; i++) {
			Map<String, MessageSystemAttributeValue> messageSystemAttributes = new HashMap<String, MessageSystemAttributeValue>();
			messageSystemAttributes.put("AWSTraceHeader", MessageSystemAttributeValue.builder().dataType("String")
					.stringValue("Root=1-56789-34c18ecfc96fd07809c3e6b0;Parent=41ddc9861af536ec;Sampled=1").build());
			sendMessageResponse = sqsClient.sendMessage(SendMessageRequest.builder().queueUrl(queueUrl)
					.messageBody("SQS Message - " + i).messageGroupId("Group-A").messageAttributes(messageAttributes)
					.messageSystemAttributesWithStrings(messageSystemAttributes).build());
			System.out.println("Message Id: " + sendMessageResponse.messageId());
		}
		AWSXRay.endSegment();
	}