Skip to content

Commit

Permalink
Update property map type
Browse files Browse the repository at this point in the history
  • Loading branch information
dilanSachi committed Oct 27, 2023
1 parent 11b8d83 commit 3de7cef
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ballerina/destination.bal
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public client class Topic {
'class: "io.ballerina.lib.ibm.ibmmq.Topic"
} external;

remote function get(GetMessageOptions options = {}) returns Message|Error =
remote function get(*GetMessageOptions options) returns Message|Error =
@java:Method {
'class: "io.ballerina.lib.ibm.ibmmq.Topic"
} external;
Expand Down
4 changes: 2 additions & 2 deletions ballerina/types.bal
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ public enum ConnectionOpenOptions {
public type AccessTopicOptions MQOO_ALTERNATE_USER_AUTHORITY|MQOO_BIND_AS_Q_DEF|MQOO_FAIL_IF_QUIESCING|MQOO_OUTPUT|MQOO_PASS_ALL_CONTEXT|MQOO_PASS_IDENTITY_CONTEXT|MQOO_SET_ALL_CONTEXT|MQOO_SET_IDENTITY_CONTEXT;

public type GetMessageOptions record {|
GM_OPTIONS options = MQGMO_NO_SYNCPOINT;
GM_OPTIONS gmOptions = MQGMO_NO_SYNCPOINT;
int waitInterval = 0;
|};

public type Property record {|
map<anydata> descriptor?;
map<int> descriptor?;
boolean|byte|byte[]|decimal|float|int|string value;
|};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.ibm.mq.MQException;
import com.ibm.mq.MQMessage;
import com.ibm.mq.MQPropertyDescriptor;
import io.ballerina.runtime.api.PredefinedTypes;
import io.ballerina.runtime.api.creators.ErrorCreator;
import io.ballerina.runtime.api.creators.TypeCreator;
import io.ballerina.runtime.api.creators.ValueCreator;
Expand Down Expand Up @@ -62,7 +63,6 @@ public class CommonUtils {
private static final BString PROPERTY_VALUE = StringUtils.fromString("value");
private static final BString PROPERTY_DESCRIPTOR = StringUtils.fromString("descriptor");


private static final MQPropertyDescriptor defaultPropertyDescriptor = new MQPropertyDescriptor();

public static MQMessage getMqMessageFromBMessage(BMap<BString, Object> bMessage) {
Expand Down Expand Up @@ -172,7 +172,8 @@ private static MQPropertyDescriptor getMQPropertyDescriptor(BMap descriptor) {
}

private static BMap populateDescriptorFromMQPropertyDescriptor(MQPropertyDescriptor propertyDescriptor) {
BMap<BString, Object> descriptor = ValueCreator.createMapValue();
BMap<BString, Object> descriptor = ValueCreator.createMapValue(TypeCreator
.createMapType(PredefinedTypes.TYPE_INT));
descriptor.put(PD_VERSION, propertyDescriptor.version);
descriptor.put(PD_COPY_OPTIONS, propertyDescriptor.copyOptions);
descriptor.put(PD_OPTIONS, propertyDescriptor.options);
Expand Down

0 comments on commit 3de7cef

Please sign in to comment.