//Create the payload
BasicPayloadData basicPayloadData = CartridgeSubscriptionUtils.createBasicPayload(cartridgeInfo, subscriptionKey, cluster, repository, alias, subscriber);
//Populate the basic payload details
basicPayloadData.populatePayload();
PayloadData payloadData = PayloadFactory.getPayloadDataInstance(cartridgeInfo.getProvider(),
cartridgeInfo.getType(), basicPayloadData);
// get the payload parameters defined in the cartridge definition file for this cartridge type
if (cartridgeInfo.getProperties() != null && cartridgeInfo.getProperties().length != 0) {
for (Property property : cartridgeInfo.getProperties()) {
// check if a property is related to the payload. Currently this is done by checking if the
// property name starts with 'payload_parameter.' suffix. If so the payload param name will
// be taken as the substring from the index of '.' to the end of the property name.
if (property.getName()
.startsWith(CartridgeConstants.CUSTOM_PAYLOAD_PARAM_NAME_PREFIX)) {
String payloadParamName = property.getName();
payloadData.add(payloadParamName.substring(payloadParamName.indexOf(".") + 1), property.getValue());
}
}
}
//check if there are any custom payload entries defined
if (customPayloadEntries != null) {
//add them to the payload
Set<Map.Entry<String,String>> entrySet = customPayloadEntries.entrySet();
for (Map.Entry<String, String> entry : entrySet) {
payloadData.add(entry.getKey(), entry.getValue());
}
}
return payloadData;
}