Class AbstractHttpClientConnectionProvider
java.lang.Object
com.mulesoft.connectors.mcp.internal.client.connection.provider.AbstractHttpClientConnectionProvider
- All Implemented Interfaces:
org.mule.runtime.api.lifecycle.Disposable,org.mule.runtime.api.lifecycle.Initialisable,org.mule.runtime.api.lifecycle.Lifecycle,org.mule.runtime.api.lifecycle.Startable,org.mule.runtime.api.lifecycle.Stoppable,org.mule.sdk.api.connectivity.CachedConnectionProvider<io.modelcontextprotocol.client.McpAsyncClient>,org.mule.sdk.api.connectivity.ConnectionProvider<io.modelcontextprotocol.client.McpAsyncClient>
- Direct Known Subclasses:
SseClientConnectionProvider,StreamableHttpClientConnectionProvider
public abstract class AbstractHttpClientConnectionProvider
extends Object
implements org.mule.sdk.api.connectivity.CachedConnectionProvider<io.modelcontextprotocol.client.McpAsyncClient>, org.mule.runtime.api.lifecycle.Lifecycle
Base class for client providers based on Http
- Since:
- 0.2.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.mule.extension.http.api.request.authentication.HttpRequestAuthenticationprotected ConfigTrackerprotected org.mule.runtime.http.api.client.HttpClientprotected org.mule.runtime.http.api.HttpServiceprotected MessagingManagerprotected org.mule.runtime.core.api.MuleContextprotected Stringprotected IntegerSets the duration to wait for server responses before timing out requests.protected TimeUnitTime Unit for the requestTimeout parameterprotected org.mule.runtime.api.tls.TlsContextFactoryWhen specified, the client will connect through httpsFields inherited from interface org.mule.runtime.api.lifecycle.Disposable
PHASE_NAMEFields inherited from interface org.mule.runtime.api.lifecycle.Initialisable
PHASE_NAMEFields inherited from interface org.mule.runtime.api.lifecycle.Startable
PHASE_NAMEFields inherited from interface org.mule.runtime.api.lifecycle.Stoppable
PHASE_NAME -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal io.modelcontextprotocol.client.McpAsyncClientconnect()protected abstract io.modelcontextprotocol.spec.McpClientTransportvoiddisconnect(io.modelcontextprotocol.client.McpAsyncClient client) final voiddispose()final voidfinal voidstart()final voidstop()org.mule.sdk.api.connectivity.ConnectionValidationResultvalidate(io.modelcontextprotocol.client.McpAsyncClient client)
-
Field Details
-
httpService
@Inject protected org.mule.runtime.http.api.HttpService httpService -
configTracker
-
messagingManager
-
muleContext
@Inject protected org.mule.runtime.core.api.MuleContext muleContext -
refName
-
requestTimeout
@Parameter @Optional(defaultValue="30") @Summary("Sets the duration to wait for server responses before timing out requests.") protected Integer requestTimeoutSets the duration to wait for server responses before timing out requests. This timeout applies to all requests made through the client, including tool calls, resource access, and prompt operations. -
requestTimeoutUnit
@Parameter @Optional(defaultValue="SECONDS") @Summary("Time Unit for the requestTimeout parameter") protected TimeUnit requestTimeoutUnitTime Unit for the requestTimeout parameter -
tlsContextFactory
@Parameter @Optional protected org.mule.runtime.api.tls.TlsContextFactory tlsContextFactoryWhen specified, the client will connect through https -
authentication
@Parameter @Optional @Placement(tab="Authentication") protected org.mule.extension.http.api.request.authentication.HttpRequestAuthentication authentication -
httpClient
protected org.mule.runtime.http.api.client.HttpClient httpClient
-
-
Constructor Details
-
AbstractHttpClientConnectionProvider
public AbstractHttpClientConnectionProvider()
-
-
Method Details
-
createClientTransport
protected abstract io.modelcontextprotocol.spec.McpClientTransport createClientTransport() -
connect
public final io.modelcontextprotocol.client.McpAsyncClient connect() throws org.mule.runtime.api.connection.ConnectionException- Specified by:
connectin interfaceorg.mule.sdk.api.connectivity.ConnectionProvider<io.modelcontextprotocol.client.McpAsyncClient>- Throws:
org.mule.runtime.api.connection.ConnectionException
-
disconnect
public void disconnect(io.modelcontextprotocol.client.McpAsyncClient client) - Specified by:
disconnectin interfaceorg.mule.sdk.api.connectivity.ConnectionProvider<io.modelcontextprotocol.client.McpAsyncClient>
-
validate
public org.mule.sdk.api.connectivity.ConnectionValidationResult validate(io.modelcontextprotocol.client.McpAsyncClient client) - Specified by:
validatein interfaceorg.mule.sdk.api.connectivity.ConnectionProvider<io.modelcontextprotocol.client.McpAsyncClient>
-
initialise
public final void initialise() throws org.mule.runtime.api.lifecycle.InitialisationException- Specified by:
initialisein interfaceorg.mule.runtime.api.lifecycle.Initialisable- Throws:
org.mule.runtime.api.lifecycle.InitialisationException
-
start
public final void start() throws org.mule.runtime.api.exception.MuleException- Specified by:
startin interfaceorg.mule.runtime.api.lifecycle.Startable- Throws:
org.mule.runtime.api.exception.MuleException
-
stop
public final void stop() throws org.mule.runtime.api.exception.MuleException- Specified by:
stopin interfaceorg.mule.runtime.api.lifecycle.Stoppable- Throws:
org.mule.runtime.api.exception.MuleException
-
dispose
public final void dispose()- Specified by:
disposein interfaceorg.mule.runtime.api.lifecycle.Disposable
-