diff --git a/compiler-plugin/src/main/java/io/ballerina/stdlib/rabbitmq/plugin/PluginConstants.java b/compiler-plugin/src/main/java/io/ballerina/stdlib/rabbitmq/plugin/PluginConstants.java index 380ca20c..0b63900d 100644 --- a/compiler-plugin/src/main/java/io/ballerina/stdlib/rabbitmq/plugin/PluginConstants.java +++ b/compiler-plugin/src/main/java/io/ballerina/stdlib/rabbitmq/plugin/PluginConstants.java @@ -44,6 +44,7 @@ public class PluginConstants { public static final String MESSAGE_CONTENT_TYPE = "contentType"; public static final String MESSAGE_CONTENT_ENCODING = "contentEncoding"; public static final String MESSAGE_CORRELATION_ID = "correlationId"; + public static final String MESSAGE_HEADERS = "headers"; // return types error or nil public static final String ERROR = "error"; diff --git a/compiler-plugin/src/main/java/io/ballerina/stdlib/rabbitmq/plugin/RabbitmqFunctionValidator.java b/compiler-plugin/src/main/java/io/ballerina/stdlib/rabbitmq/plugin/RabbitmqFunctionValidator.java index 7cd87a98..577a158a 100644 --- a/compiler-plugin/src/main/java/io/ballerina/stdlib/rabbitmq/plugin/RabbitmqFunctionValidator.java +++ b/compiler-plugin/src/main/java/io/ballerina/stdlib/rabbitmq/plugin/RabbitmqFunctionValidator.java @@ -107,6 +107,7 @@ import static io.ballerina.stdlib.rabbitmq.plugin.PluginConstants.MESSAGE_CORRELATION_ID; import static io.ballerina.stdlib.rabbitmq.plugin.PluginConstants.MESSAGE_DELIVERY_TAG; import static io.ballerina.stdlib.rabbitmq.plugin.PluginConstants.MESSAGE_EXCHANGE; +import static io.ballerina.stdlib.rabbitmq.plugin.PluginConstants.MESSAGE_HEADERS; import static io.ballerina.stdlib.rabbitmq.plugin.PluginConstants.MESSAGE_PROPERTIES; import static io.ballerina.stdlib.rabbitmq.plugin.PluginConstants.MESSAGE_REPLY_TO; import static io.ballerina.stdlib.rabbitmq.plugin.PluginConstants.MESSAGE_ROUTING_KEY; @@ -403,10 +404,11 @@ private boolean validatePropertiesField(TypeSymbol propertiesTypeSymbol) { propertiesRecordSymbol = (RecordTypeSymbol) propertiesTypeSymbol; } Map propertiesFieldDescriptors = propertiesRecordSymbol.fieldDescriptors(); - if (propertiesFieldDescriptors.size() != 4 || !propertiesFieldDescriptors.containsKey(MESSAGE_REPLY_TO) || + if (propertiesFieldDescriptors.size() != 5 || !propertiesFieldDescriptors.containsKey(MESSAGE_REPLY_TO) || !propertiesFieldDescriptors.containsKey(MESSAGE_CONTENT_TYPE) || !propertiesFieldDescriptors.containsKey(MESSAGE_CONTENT_ENCODING) || - !propertiesFieldDescriptors.containsKey(MESSAGE_CORRELATION_ID)) { + !propertiesFieldDescriptors.containsKey(MESSAGE_CORRELATION_ID) || + !propertiesFieldDescriptors.containsKey(MESSAGE_HEADERS)) { return false; } if (propertiesFieldDescriptors.get(MESSAGE_REPLY_TO).typeDescriptor().typeKind() != STRING) { @@ -421,6 +423,9 @@ private boolean validatePropertiesField(TypeSymbol propertiesTypeSymbol) { if (propertiesFieldDescriptors.get(MESSAGE_CORRELATION_ID).typeDescriptor().typeKind() != STRING) { return false; } + if (propertiesFieldDescriptors.get(MESSAGE_HEADERS).typeDescriptor().typeKind() != MAP) { + return false; + } return true; }