本文整理了Java中org.apache.camel.spi.UuidGenerator.generateUuid()
方法的一些代码示例,展示了UuidGenerator.generateUuid()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。UuidGenerator.generateUuid()
方法的具体详情如下:
包路径:org.apache.camel.spi.UuidGenerator
类名称:UuidGenerator
方法名:generateUuid
暂无
代码示例来源:origin: org.apache.camel/camel-zookeeper
private String createCandidateName() {
StringBuilder builder = new StringBuilder();
try {
/* UUID would be enough, also using hostname for human readability */
builder.append(InetAddress.getLocalHost().getCanonicalHostName());
} catch (UnknownHostException ex) {
LOG.warn("Failed to get the local hostname.", ex);
builder.append("unknown-host");
}
builder.append("-").append(uuidGenerator.generateUuid());
return builder.toString();
}
代码示例来源:origin: org.apache.camel/camel-zookeeper
private String createCandidateName() {
StringBuilder builder = new StringBuilder();
try {
/* UUID would be enough, also using hostname for human readability */
builder.append(InetAddress.getLocalHost().getCanonicalHostName());
} catch (UnknownHostException ex) {
LOG.warn("Failed to get the local hostname.", ex);
builder.append("unknown-host");
}
builder.append("-").append(uuidGenerator.generateUuid());
return builder.toString();
}
代码示例来源:origin: org.apache.camel/camel-zookeeper
private String createCandidateName() {
StringBuilder builder = new StringBuilder();
try {
/* UUID would be enough, also using hostname for human readability */
builder.append(InetAddress.getLocalHost().getCanonicalHostName());
} catch (UnknownHostException ex) {
LOG.warn("Failed to get the local hostname.", ex);
builder.append("unknown-host");
}
builder.append("-").append(uuidGenerator.generateUuid());
return builder.toString();
}
代码示例来源:origin: org.apache.camel/camel-reactive-streams
@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);
}
代码示例来源:origin: org.apache.camel/camel-service
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();
}
}
代码示例来源:origin: org.apache.camel/camel-hdfs2
private StringBuilder newFileName() {
StringBuilder actualPath = new StringBuilder(hdfsPath);
actualPath.append(StringHelper.sanitize(getEndpoint().getCamelContext().getUuidGenerator().generateUuid()));
return actualPath;
}
代码示例来源:origin: org.apache.camel/camel-reactive-streams
@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));
}
代码示例来源:origin: org.apache.camel/camel-rxjava2
@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);
}
代码示例来源:origin: org.apache.camel/camel-reactor
@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);
}
代码示例来源:origin: org.apache.camel/camel-reactor
@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);
}
代码示例来源:origin: org.apache.camel/camel-reactor
@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);
}
}
代码示例来源:origin: org.apache.camel/camel-reactive-streams
@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);
}
}
代码示例来源:origin: org.apache.camel/camel-rxjava2
@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);
}
代码示例来源:origin: org.apache.camel/camel-rxjava2
@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);
}
}
代码示例来源:origin: org.fusesource.insight/insight-camel
@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);
}
}
}
代码示例来源:origin: jboss-fuse/fabric8
@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);
}
}
}
}
代码示例来源:origin: org.apache.camel/camel-jms
final String provisionalCorrelationId = msgIdAsCorrId ? getUuidGenerator().generateUuid() : null;
MessageSentCallback messageSentCallback = null;
if (msgIdAsCorrId) {
if (generateFreshCorrId) {
in.setHeader(correlationPropertyToUse, GENERATED_CORRELATION_ID_PREFIX + getUuidGenerator().generateUuid());
代码示例来源:origin: org.apache.camel/camel-quartz2
id = "trigger-" + getCamelContext().getUuidGenerator().generateUuid();
代码示例来源:origin: org.apache.camel/camel-rabbitmq
String correlationId = GENERATED_CORRELATION_ID_PREFIX + getEndpoint().getCamelContext().getUuidGenerator().generateUuid();
in.setHeader(RabbitMQConstants.CORRELATIONID, correlationId);
代码示例来源:origin: org.fusesource.bai/bai-core
ae.getExchange().setProperty(AuditConstants.DISPATCH_ID, ae.getExchange().getContext().getUuidGenerator().generateUuid());
内容来源于网络,如有侵权,请联系作者删除!