Skip to content

Commit 74efa08

Browse files
authored
Remove unused code (Azure#17793)
1 parent 83d9e36 commit 74efa08

File tree

2 files changed

+0
-72
lines changed

2 files changed

+0
-72
lines changed

sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/ServiceBusClientBuilder.java

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -983,24 +983,6 @@ ServiceBusReceiverAsyncClient buildAsyncClientForProcessor() {
983983
return buildAsyncClientForProcessor(true);
984984
}
985985

986-
/**
987-
* Creates a <b>synchronous</b>, <b>session-aware</b> Service Bus receiver responsible for reading {@link
988-
* ServiceBusMessage messages} from a specific queue or subscription.
989-
*
990-
* @return An new {@link ServiceBusReceiverClient} that receives messages from a queue or subscription.
991-
* @throws IllegalStateException if {@link #queueName(String) queueName} or {@link #topicName(String)
992-
* topicName} are not set or, both of these fields are set. It is also thrown if the Service Bus {@link
993-
* #connectionString(String) connectionString} contains an {@code EntityPath} that does not match one set in
994-
* {@link #queueName(String) queueName} or {@link #topicName(String) topicName}. Lastly, if a {@link
995-
* #topicName(String) topicName} is set, but {@link #subscriptionName(String) subscriptionName} is not.
996-
* @throws IllegalArgumentException Queue or topic name are not set via {@link #queueName(String)
997-
* queueName()} or {@link #topicName(String) topicName()}, respectively.
998-
*/
999-
ServiceBusReceiverClient buildClientForProcessor() {
1000-
return new ServiceBusReceiverClient(buildAsyncClientForProcessor(false),
1001-
MessageUtils.getTotalTimeout(retryOptions));
1002-
}
1003-
1004986
private ServiceBusReceiverAsyncClient buildAsyncClientForProcessor(boolean isAutoCompleteAllowed) {
1005987
final MessagingEntityType entityType = validateEntityPaths(logger, connectionStringEntityName, topicName,
1006988
queueName);

sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/implementation/MessageUtils.java

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@
99
import com.azure.core.amqp.implementation.TracerProvider;
1010
import com.azure.core.util.Context;
1111
import com.azure.core.util.CoreUtils;
12-
import com.azure.core.util.logging.ClientLogger;
1312
import com.azure.core.util.tracing.ProcessKind;
1413
import com.azure.messaging.servicebus.ServiceBusMessage;
15-
import com.azure.messaging.servicebus.ServiceBusReceivedMessage;
1614
import com.azure.messaging.servicebus.ServiceBusTransactionContext;
1715
import org.apache.qpid.proton.amqp.Binary;
1816
import org.apache.qpid.proton.amqp.Symbol;
@@ -25,15 +23,12 @@
2523
import org.apache.qpid.proton.amqp.transport.ErrorCondition;
2624
import reactor.core.publisher.Signal;
2725

28-
import java.io.Closeable;
29-
import java.io.IOException;
3026
import java.nio.ByteBuffer;
3127
import java.time.Duration;
3228
import java.time.Instant;
3329
import java.time.OffsetDateTime;
3430
import java.time.ZoneOffset;
3531
import java.util.HashMap;
36-
import java.util.Locale;
3732
import java.util.Map;
3833
import java.util.Optional;
3934
import java.util.UUID;
@@ -42,8 +37,6 @@
4237
import static com.azure.core.util.tracing.Tracer.DIAGNOSTIC_ID_KEY;
4338
import static com.azure.core.util.tracing.Tracer.ENTITY_PATH_KEY;
4439
import static com.azure.core.util.tracing.Tracer.HOST_NAME_KEY;
45-
import static com.azure.core.util.tracing.Tracer.MESSAGE_ENQUEUED_TIME;
46-
import static com.azure.core.util.tracing.Tracer.SCOPE_KEY;
4740
import static com.azure.core.util.tracing.Tracer.SPAN_CONTEXT_KEY;
4841
import static com.azure.messaging.servicebus.implementation.ServiceBusConstants.AZ_TRACING_SERVICE_NAME;
4942
import static com.azure.messaging.servicebus.implementation.ServiceBusConstants.AZ_TRACING_NAMESPACE_VALUE;
@@ -329,51 +322,4 @@ public static ServiceBusMessage traceMessageSpan(ServiceBusMessage serviceBusMes
329322
}
330323
return serviceBusMessage;
331324
}
332-
333-
/*
334-
* Starts a new process tracing span and attaches the returned context to the ServiceBusReceivedMessage object for
335-
* users.
336-
*/
337-
public static Context startProcessTracingSpan(ServiceBusReceivedMessage receivedMessage,
338-
String hostname, String entityPath, TracerProvider tracerProvider, ProcessKind processKind) {
339-
Object diagnosticId = receivedMessage.getApplicationProperties().get(DIAGNOSTIC_ID_KEY);
340-
if (diagnosticId == null || !tracerProvider.isEnabled()) {
341-
return Context.NONE;
342-
}
343-
344-
Context spanContext = tracerProvider.extractContext(diagnosticId.toString(), Context.NONE)
345-
.addData(ENTITY_PATH_KEY, entityPath)
346-
.addData(HOST_NAME_KEY, hostname)
347-
.addData(AZ_TRACING_NAMESPACE_KEY, AZ_TRACING_NAMESPACE_VALUE);
348-
spanContext = receivedMessage.getEnqueuedTime() == null
349-
? spanContext
350-
: spanContext.addData(MESSAGE_ENQUEUED_TIME, receivedMessage.getEnqueuedTime().toEpochSecond());
351-
return tracerProvider.startSpan(AZ_TRACING_SERVICE_NAME, spanContext, processKind);
352-
}
353-
354-
/*
355-
* Ends the process tracing span and the scope of that span.
356-
*/
357-
public static void endProcessTracingSpan(Context processSpanContext, Signal<Void> signal,
358-
TracerProvider tracerProvider, ClientLogger logger) {
359-
if (processSpanContext != null) {
360-
Optional<Object> spanScope = processSpanContext.getData(SCOPE_KEY);
361-
// Disposes of the scope when the trace span closes.
362-
if (tracerProvider.isEnabled() && spanScope.isPresent()) {
363-
if (spanScope.get() instanceof Closeable) {
364-
Closeable close = (Closeable) spanScope.get();
365-
try {
366-
close.close();
367-
tracerProvider.endSpan(processSpanContext, signal);
368-
} catch (IOException ioException) {
369-
logger.error(Messages.MESSAGE_PROCESSOR_RUN_END, ioException);
370-
}
371-
372-
} else {
373-
logger.warning(String.format(Locale.US,
374-
Messages.PROCESS_SPAN_SCOPE_TYPE_ERROR, spanScope.getClass()));
375-
}
376-
}
377-
}
378-
}
379325
}

0 commit comments

Comments
 (0)