setUpServiceClientAnonymousOperations (serviceClient);
Options options = serviceClient.getOptions();
if (options == null)
throw new SandeshaException(SandeshaMessageHelper.getMessage(
SandeshaMessageKeys.optionsObjectNotSet));
EndpointReference toEPR = serviceClient.getOptions().getTo();
if (toEPR == null)
throw new SandeshaException(SandeshaMessageHelper.getMessage(
SandeshaMessageKeys.toEPRNotValid, null));
String to = toEPR.getAddress();
if (to == null)
throw new SandeshaException(SandeshaMessageHelper.getMessage(
SandeshaMessageKeys.toEPRNotValid, null));
if (offer) {
String offeredSequenceID = SandeshaUtil.getUUID();
options.setProperty(SandeshaClientConstants.OFFERED_SEQUENCE_ID, offeredSequenceID);
}
// setting a new squenceKey if not already set.
String oldSequenceKey = (String) options.getProperty(SandeshaClientConstants.SEQUENCE_KEY);
options.setProperty(SandeshaClientConstants.SEQUENCE_KEY, sequenceKey);
String rmSpecVersion = (String) options.getProperty(SandeshaClientConstants.RM_SPEC_VERSION);
if (rmSpecVersion == null)
rmSpecVersion = SpecSpecificConstants.getDefaultSpecVersion();
//When the message is marked as Dummy the application processor will not actually try to send it.
//But still the create Sequence will be added.
options.setProperty(SandeshaClientConstants.DUMMY_MESSAGE, Sandesha2Constants.VALUE_TRUE);
String oldAction = options.getAction();
options.setAction(SpecSpecificConstants.getCreateSequenceAction(rmSpecVersion));
ServiceContext serviceContext = serviceClient.getServiceContext();
if (serviceContext == null)
throw new SandeshaException(SandeshaMessageHelper.getMessage(
SandeshaMessageKeys.serviceContextNotSet));
ConfigurationContext configurationContext = serviceContext.getConfigurationContext();
// cleanup previous sequence
cleanupTerminatedSequence(to, oldSequenceKey, SandeshaUtil.getSandeshaStorageManager(configurationContext, configurationContext.getAxisConfiguration()));
try {
//just to inform the sender.
serviceClient.fireAndForget (null);
} catch (AxisFault e) {
throw new SandeshaException(e);
}
finally {
options.setAction(oldAction);
options.setProperty(SandeshaClientConstants.DUMMY_MESSAGE, Sandesha2Constants.VALUE_FALSE);