I am attempting to send a message to SQS and I have followed instructions laid here
https://docs.aws.amazon.com/sdk-for-php/v3/developer-guide/sqs-examples-send-receive-messages.html
However, when I follow these I do not get anything, not even an error message. The code is as follows:
use Aws\Exception\AwsException;
use Aws\Credentials\Credentials;
use Aws\Sqs\SqsClient;
$credentials = new Credentials('IAM account key', 'IAM secret key')
$sqsClient = new SqsClient([
'version' => '2012-11-05',
'credentials' => $credentials,
'region' => 'eu-north-1',
]);
//Debug values, these would later be filled from database
$params = [
'DelaySeconds' => 10,
'MessageAttributes' => [
"SocialSecurityCode" => [
'DataType' => "String",
'StringValue' => "111111-1"
],
"Name" => [
'DataType' => "String",
'StringValue' => "Teemu Testaaja"
],
"PeriodStart" => [
'DataType' => "String",
'StringValue' => "1-1-2019"
],
"PeriodEnd" => [
'DataType' => "String",
'StringValue' => "31-1-2019"
],
"EventDate" => [
'DataType' => "String",
'StringValue' => "12-1-2019"
],
"Code" => [
'DataType' => "Number",
'StringValue' => "12"
],
"Amount" => [
'DataType' => "Number",
'StringValue' => "7.5"
]
],
'MessageBody' => "Test message",
'QueueUrl' => 'sqs-url from the console'
];
try {
print("Sending message");
$result = $sqsClient->sendMessage($params);
print("Message send");
var_dump($result);
} catch (AwsException $e) {
// output error message if fails
print("ERROR!");
var_dump($e->getMessage());
}
Yet, only thing I get out is "Sending message". What am I doing wrong here? I have an IAM account set up with ability to send and read messages from the queu.
I tried to look at the queu to see if messages did pass and there was something else, but there are no items in the queu and there is currently nothing reading it.
Code is hosted on Amazon AWS server.
UPDATE
As of now, messages are correctly passed to the queu, but code does not proceed from sendMessages part forward.