use of org.apache.camel.PollingConsumer in project syncope by apache.
the class CamelUserProvisioningManager method suspend.
@Override
@SuppressWarnings("unchecked")
public Pair<String, List<PropagationStatus>> suspend(final StatusPatch statusPatch, final boolean nullPriorityAsync) {
PollingConsumer pollingConsumer = getConsumer("direct:statusPort");
Map<String, Object> props = new HashMap<>();
props.put("key", statusPatch.getKey());
props.put("statusPatch", statusPatch);
props.put("nullPriorityAsync", nullPriorityAsync);
if (statusPatch.isOnSyncope()) {
sendMessage("direct:suspendUser", statusPatch.getKey(), props);
} else {
WorkflowResult<String> updated = new WorkflowResult<>(statusPatch.getKey(), null, statusPatch.getType().name().toLowerCase());
sendMessage("direct:userStatusPropagation", updated, props);
}
Exchange exchange = pollingConsumer.receive();
if (exchange.getProperty(Exchange.EXCEPTION_CAUGHT) != null) {
throw (RuntimeException) exchange.getProperty(Exchange.EXCEPTION_CAUGHT);
}
return exchange.getIn().getBody(Pair.class);
}
use of org.apache.camel.PollingConsumer in project syncope by apache.
the class CamelUserProvisioningManager method confirmPasswordReset.
@Override
public void confirmPasswordReset(final String key, final String token, final String password) {
PollingConsumer pollingConsumer = getConsumer("direct:confirmPwdResetPort");
Map<String, Object> props = new HashMap<>();
props.put("key", key);
props.put("token", token);
props.put("password", password);
sendMessage("direct:confirmPwdReset", key, props);
Exchange exchange = pollingConsumer.receive();
if (exchange.getProperty(Exchange.EXCEPTION_CAUGHT) != null) {
throw (RuntimeException) exchange.getProperty(Exchange.EXCEPTION_CAUGHT);
}
}
use of org.apache.camel.PollingConsumer in project syncope by apache.
the class CamelUserProvisioningManager method link.
@Override
public String link(final UserPatch anyPatch) {
PollingConsumer pollingConsumer = getConsumer("direct:linkPort");
sendMessage("direct:linkUser", anyPatch);
Exchange exchange = pollingConsumer.receive();
if (exchange.getProperty(Exchange.EXCEPTION_CAUGHT) != null) {
throw (RuntimeException) exchange.getProperty(Exchange.EXCEPTION_CAUGHT);
}
return exchange.getIn().getBody(UserPatch.class).getKey();
}
use of org.apache.camel.PollingConsumer in project syncope by apache.
the class CamelUserProvisioningManager method delete.
@Transactional(propagation = Propagation.REQUIRES_NEW)
@Override
@SuppressWarnings("unchecked")
public List<PropagationStatus> delete(final String key, final Set<String> excludedResources, final boolean nullPriorityAsync) {
PollingConsumer pollingConsumer = getConsumer("direct:deletePort");
Map<String, Object> props = new HashMap<>();
props.put("excludedResources", excludedResources);
props.put("nullPriorityAsync", nullPriorityAsync);
sendMessage("direct:deleteUser", key, props);
Exchange exchange = pollingConsumer.receive();
if (exchange.getProperty(Exchange.EXCEPTION_CAUGHT) != null) {
throw (RuntimeException) exchange.getProperty(Exchange.EXCEPTION_CAUGHT);
}
return exchange.getIn().getBody(List.class);
}
use of org.apache.camel.PollingConsumer in project syncope by apache.
the class CamelUserProvisioningManager method deprovision.
@Override
@SuppressWarnings("unchecked")
public List<PropagationStatus> deprovision(final String user, final Collection<String> resources, final boolean nullPriorityAsync) {
PollingConsumer pollingConsumer = getConsumer("direct:deprovisionPort");
Map<String, Object> props = new HashMap<>();
props.put("resources", resources);
props.put("nullPriorityAsync", nullPriorityAsync);
sendMessage("direct:deprovisionUser", user, props);
Exchange exchange = pollingConsumer.receive();
if (exchange.getProperty(Exchange.EXCEPTION_CAUGHT) != null) {
throw (RuntimeException) exchange.getProperty(Exchange.EXCEPTION_CAUGHT);
}
return exchange.getIn().getBody(List.class);
}
Aggregations