@Override public Publisher<Exchange> to(String uri, Object data) { requestedUriToStream.computeIfAbsent(uri, u -> { try { String uuid = context.getUuidGenerator().generateUuid(); new RouteBuilder() { @Override public void configure() throws Exception { from("reactive-streams:" + uuid) .to(u); } }.addRoutesToCamelContext(context); return uuid; } catch (Exception e) { throw new IllegalStateException("Unable to create requested reactive stream from direct URI: " + uri, e); } }); return toStream(requestedUriToStream.get(uri), data); }
private ServiceDefinition computeServiceDefinition(CamelContext context, Endpoint delegateEndpoint) { Map<String, String> parameters = new HashMap<>(); if (delegateEndpoint instanceof DiscoverableService) { parameters.putAll(((DiscoverableService)delegateEndpoint).getServiceProperties()); } parameters.putAll(serviceParameters); parameters.computeIfAbsent(ServiceDefinition.SERVICE_META_ID, k -> context.getUuidGenerator().generateUuid()); return DefaultServiceDefinition.builder().from(parameters).build(); } }
private StringBuilder newFileName() { StringBuilder actualPath = new StringBuilder(hdfsPath); actualPath.append(StringHelper.sanitize(getEndpoint().getCamelContext().getUuidGenerator().generateUuid())); return actualPath; }
@Override public Publisher<Exchange> from(String uri) { publishedUriToStream.computeIfAbsent(uri, u -> { try { String uuid = context.getUuidGenerator().generateUuid(); new RouteBuilder() { @Override public void configure() throws Exception { from(u) .to("reactive-streams:" + uuid); } }.addRoutesToCamelContext(context); return uuid; } catch (Exception e) { throw new IllegalStateException("Unable to create source reactive stream from direct URI: " + uri, e); } }); return fromStream(publishedUriToStream.get(uri)); }
@Override public Publisher<Exchange> to(String uri, Object data) { String streamName = requestedUriToStream.computeIfAbsent(uri, camelUri -> { try { String uuid = context.getUuidGenerator().generateUuid(); context.addRoutes(new RouteBuilder() { @Override public void configure() throws Exception { from("reactive-streams:" + uuid) .to(camelUri); } }); return uuid; } catch (Exception e) { throw new IllegalStateException("Unable to create requested reactive stream from direct URI: " + uri, e); } }); return toStream(streamName, data); }
@Override public Publisher<Exchange> to(String uri, Object data) { String streamName = requestedUriToStream.computeIfAbsent(uri, camelUri -> { try { String uuid = context.getUuidGenerator().generateUuid(); context.addRoutes(new RouteBuilder() { @Override public void configure() throws Exception { from("reactive-streams:" + uuid) .to(camelUri); } }); return uuid; } catch (Exception e) { throw new IllegalStateException("Unable to create requested reactive stream from direct URI: " + uri, e); } }); return toStream(streamName, data); }
@Override public Publisher<Exchange> from(String uri) { final String name = publishedUriToStream.computeIfAbsent(uri, camelUri -> { try { String uuid = context.getUuidGenerator().generateUuid(); context.addRoutes(new RouteBuilder() { @Override public void configure() throws Exception { from(camelUri).to("reactive-streams:" + uuid); } }); return uuid; } catch (Exception e) { throw new IllegalStateException("Unable to create source reactive stream from direct URI: " + uri, e); } }); return fromStream(name); }
@Override public Publisher<Exchange> from(String uri) { final String name = publishedUriToStream.computeIfAbsent(uri, camelUri -> { try { String uuid = context.getUuidGenerator().generateUuid(); context.addRoutes(new RouteBuilder() { @Override public void configure() throws Exception { from(camelUri).to("reactive-streams:" + uuid); } }); return uuid; } catch (Exception e) { throw new IllegalStateException("Unable to create source reactive stream from direct URI: " + uri, e); } }); return fromStream(name); }
@Override public Subscriber<Exchange> subscriber(String uri) { try { String uuid = context.getUuidGenerator().generateUuid(); context.addRoutes(new RouteBuilder() { @Override public void configure() throws Exception { from("reactive-streams:" + uuid) .to(uri); } }); return streamSubscriber(uuid); } catch (Exception e) { throw new IllegalStateException("Unable to create source reactive stream towards direct URI: " + uri, e); } }
@Override public Subscriber<Exchange> subscriber(String uri) { try { String uuid = context.getUuidGenerator().generateUuid(); new RouteBuilder() { @Override public void configure() throws Exception { from("reactive-streams:" + uuid) .to(uri); } }.addRoutesToCamelContext(context); return streamSubscriber(uuid); } catch (Exception e) { throw new IllegalStateException("Unable to create source reactive stream towards direct URI: " + uri, e); } }
@Override public Subscriber<Exchange> subscriber(String uri) { try { String uuid = context.getUuidGenerator().generateUuid(); context.addRoutes(new RouteBuilder() { @Override public void configure() throws Exception { from("reactive-streams:" + uuid) .to(uri); } }); return streamSubscriber(uuid); } catch (Exception e) { throw new IllegalStateException("Unable to create source reactive stream towards direct URI: " + uri, e); } }
@Override public void notify(EventObject eventObject) throws Exception { if (eventObject instanceof AbstractExchangeEvent) { AbstractExchangeEvent aee = (AbstractExchangeEvent) eventObject; if (isEnabled(aee.getExchange())) { if (aee instanceof ExchangeSendingEvent) { aee.getExchange().getIn().setHeader("AuditCallId", aee.getExchange().getContext().getUuidGenerator().generateUuid()); } String json = toJson(aee); storage.store(type, System.currentTimeMillis(), json); } } }
protected void doStart() throws Exception { super.doStart(); if (uuidGenerator == null) { // use the generator configured on the camel context uuidGenerator = getEndpoint().getCamelContext().getUuidGenerator(); } if (endpoint.isTestConnectionOnStartup()) { testConnectionOnStartup(); } }
@Test public void testContextConfiguration() { assertThat(applicationContext.getBeansOfType(CamelContextConfiguration.class)).hasSize(2); assertThat(applicationContext.getBeansOfType(ActivityTracker.class)).hasSize(1); assertThat(applicationContext.getBeansOfType(ActivityTracker.class).values()).hasAtLeastOneElementOfType(ActivityTracker.SysOut.class); assertThat(camelContext.getLogListeners()).hasAtLeastOneElementOfType(IntegrationLoggingListener.class); assertThat(camelContext.getUuidGenerator()).isNotInstanceOf(DefaultUuidGenerator.class); } }
@Override public void notify(EventObject eventObject) throws Exception { if (eventObject instanceof AbstractExchangeEvent) { AbstractExchangeEvent aee = (AbstractExchangeEvent) eventObject; if (isEnabled(aee.getExchange())) { if (aee instanceof ExchangeSendingEvent) { aee.getExchange().getIn().setHeader("AuditCallId", aee.getExchange().getContext().getUuidGenerator().generateUuid()); } String json = toJson(aee); if (getStorage() != null) { getStorage().store(type, System.currentTimeMillis(), json); } } } }
@Test public void testDisabledContextConfiguration() { assertThat(applicationContext.getBeansOfType(CamelContextConfiguration.class)).is(new Condition<Map<String, CamelContextConfiguration>>() { @Override public boolean matches(Map<String, CamelContextConfiguration> value) { return value.size() == 1 && value.containsKey("integrationContextRuntimeConfiguration"); } }); assertThat(camelContext.getLogListeners()).have(new Condition<LogListener>() { @Override public boolean matches(LogListener value) { return !(value instanceof IntegrationLoggingListener); } }); assertThat(camelContext.getUuidGenerator()).isInstanceOf(DefaultUuidGenerator.class); }
id = "trigger-" + getCamelContext().getUuidGenerator().generateUuid();
String correlationId = GENERATED_CORRELATION_ID_PREFIX + getEndpoint().getCamelContext().getUuidGenerator().generateUuid(); in.setHeader(RabbitMQConstants.CORRELATIONID, correlationId);
ae.getExchange().setProperty(AuditConstants.DISPATCH_ID, ae.getExchange().getContext().getUuidGenerator().generateUuid());
service.setId(camelContext.getUuidGenerator().generateUuid());