ExMCP.MessageProcessor.Migration (ex_mcp v0.10.0)
View SourceMigration module to transition MessageProcessor to use the unified dispatcher.
This module provides a facade that maintains backward compatibility while internally using the new Dispatcher and Handlers modules. This allows for a gradual migration without breaking existing code.
Summary
Functions
Replaces the three dispatch maps with a single unified dispatcher call.
Helper to create backward-compatible error response format.
Converts old dispatch map calls to use the unified dispatcher.
Helper to create backward-compatible response format.
Functions
Replaces the three dispatch maps with a single unified dispatcher call.
This function can be used as a drop-in replacement for the existing dispatch map lookups in MessageProcessor.
Helper to create backward-compatible error response format.
Converts old dispatch map calls to use the unified dispatcher.
Old pattern:
case Map.get(handler_method_dispatch(), method) do
nil -> handle_handler_custom_method(conn, server_pid, method, params, id)
handler_fun -> handler_fun.(conn, server_pid, params, id)
endNew pattern:
Migration.dispatch_request(conn, server_pid, :handler, method, params, id)
Helper to create backward-compatible response format.