<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Edgardo Genini</title>
    <description>The latest articles on DEV Community by Edgardo Genini (@edgardo_genini).</description>
    <link>https://dev.to/edgardo_genini</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3928203%2F27f3b1f6-140c-4040-9fe6-9bddde21d168.png</url>
      <title>DEV Community: Edgardo Genini</title>
      <link>https://dev.to/edgardo_genini</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/edgardo_genini"/>
    <language>en</language>
    <item>
      <title>[EN] Delegated Resource Identifier (DRI): a pattern for persistent references in microservices</title>
      <dc:creator>Edgardo Genini</dc:creator>
      <pubDate>Wed, 13 May 2026 01:39:17 +0000</pubDate>
      <link>https://dev.to/edgardo_genini/en-delegated-resource-identifier-dri-a-pattern-for-persistent-references-in-microservices-2o52</link>
      <guid>https://dev.to/edgardo_genini/en-delegated-resource-identifier-dri-a-pattern-for-persistent-references-in-microservices-2o52</guid>
      <description>&lt;p&gt;&lt;a href="https://dev.to/edgardo_genini/es-delegated-resource-identifier-dri-un-patron-para-referencias-persistentes-en-microservicios-big"&gt;Also available in Spanish&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you've ever stored a URL in a database and later regretted it, this is for you.&lt;/p&gt;

&lt;p&gt;It's a familiar scenario: a service needs to keep a reference to a resource that lives in another service. The obvious solution is to store the URL. It works — until the host changes, the API gets a new version, or the team decides to restructure the paths. Suddenly all the stored references are broken, and tracking down the impact becomes a bigger problem than it should be.&lt;/p&gt;

&lt;p&gt;The root issue is that a URL mixes two different things: &lt;em&gt;what&lt;/em&gt; the resource is and &lt;em&gt;where&lt;/em&gt; it lives. When you store a URL, you're betting that location won't change. In systems that evolve, that's usually a losing bet.&lt;/p&gt;

&lt;h2&gt;
  
  
  The idea
&lt;/h2&gt;

&lt;p&gt;What if instead of storing where the resource lives, you store your own identifier that a gateway knows how to resolve?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;commerce:orders/order:id=ARG-2024-00091872
finance:accounts/customer:status:id=109234
health:coverage/credential:patient-id=12345678
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Whoever stores the reference doesn't need to know where the resource lives or how to access it. That's the gateway's responsibility. If the API changes, if the service migrates, if a new system appears: only the resolver changes. The stored references remain valid.&lt;/p&gt;

&lt;p&gt;I called this scheme &lt;strong&gt;Delegated Resource Identifier (DRI)&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this pattern is not
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;It's not a standard&lt;/li&gt;
&lt;li&gt;It requires a gateway as intermediary: it doesn't apply when the client needs to access the resource directly without going through any intermediary&lt;/li&gt;
&lt;li&gt;It doesn't impose a context taxonomy: each team defines their own&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It's a useful convention when you need persistent references to resources in a controlled ecosystem and want to centralize the resolution logic.&lt;/p&gt;

&lt;h2&gt;
  
  
  How it's built
&lt;/h2&gt;

&lt;p&gt;The identifier has two parts separated by &lt;code&gt;/&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;context&amp;gt;/&amp;lt;resource&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Context&lt;/strong&gt; (left side): identifies the domain that knows how to resolve this type of resource. The gateway uses it for routing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Resource&lt;/strong&gt; (right side): identifies the concrete resource. Its structure is defined by whoever implements the resolver.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;commerce:orders/order:id=ARG-2024-00091872
└─── routing ───┘└─── concrete resource ──┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;:&lt;/code&gt; separates hierarchical levels. &lt;code&gt;=&lt;/code&gt; assigns values. Each side defines its own internal convention.&lt;/p&gt;

&lt;p&gt;The identifier is built by whoever stores the reference, from the data they already have and the context they know. No external call required. A billing service that receives an order ID knows it belongs to &lt;code&gt;commerce:orders&lt;/code&gt; and builds the DRI when persisting the reference.&lt;/p&gt;

&lt;p&gt;The context can be omitted if the gateway has a default resolver:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/order:id=ARG-2024-00091872
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Some use cases
&lt;/h2&gt;

&lt;h3&gt;
  
  
  E-commerce: retrieving an order
&lt;/h3&gt;

&lt;p&gt;A customer service system stores references to orders that can come from different channels: own store, marketplace, mobile app. Each channel has its own API.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;commerce:orders/order:id=ARG-2024-00091872
commerce:orders/order:id=MKT-2024-00034521
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;commerce:orders&lt;/code&gt; resolver determines which channel each order belongs to based on the ID prefix and routes to the corresponding API. The identifier remains stable even if the channel's API changes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Fintech: customer account status
&lt;/h3&gt;

&lt;p&gt;A bank with legacy and modern systems running side by side. The resolver determines which system the customer lives in based on the ID value: customers with &lt;code&gt;id &amp;lt; 50000&lt;/code&gt; are in the legacy system, the rest in the modern one.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;finance:accounts/customer:status:id=109234
finance:accounts/customer:status:id=002871
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The resolver also encapsulates the decision of which API version to use. And here something interesting emerges: the DRI has two moments in its lifecycle. When persisted, it's just the identifier. When used for a query, it can be enriched with additional context using the same syntax:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;finance:accounts/customer:status:id=109234:date=20260101
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The resolver can use that date to determine which API version applies. The persisted DRI doesn't change; the additional context is added at query time.&lt;/p&gt;

&lt;h3&gt;
  
  
  Health: member coverage credential
&lt;/h3&gt;

&lt;p&gt;A member's coverage can change over time: provider migration, gaps in coverage, or coverage with more than one provider. Storing the provider as a fixed value would produce outdated references.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;health:coverage/credential:patient-id=12345678
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The resolver applies a fallback strategy: it queries the first available provider and if the credential isn't found, tries the next one. The DRI resolves at query time, always reflecting the current state.&lt;/p&gt;

&lt;h3&gt;
  
  
  Multinational with tenant: supplier by legal entity
&lt;/h3&gt;

&lt;p&gt;A SaaS platform used by a company operating in multiple countries. Each country has its own supplier management system, its own API, and its own tax identifier format.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;tenant:acme:ar/supplier:cuit=20123456789
tenant:acme:cl/supplier:rut=76354921-5
tenant:acme:mx/supplier:rfc=XYZ123456789
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The left side combines tenant and legal entity by country. The right side respects the local convention without the gateway knowing anything about it. Adding a new subsidiary or tenant means registering an additional resolver, without touching existing references. The context hierarchy grows naturally with the system.&lt;/p&gt;

&lt;h2&gt;
  
  
  How the gateway works
&lt;/h2&gt;

&lt;p&gt;The resolution flow is simple: the gateway receives the identifier, extracts the context, and delegates to the corresponding resolver.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;client  →  gateway  →  resolver(commerce:orders)  →  actual service
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Receives the identifier&lt;/li&gt;
&lt;li&gt;Extracts the context (left side)&lt;/li&gt;
&lt;li&gt;Delegates to the registered resolver for that context&lt;/li&gt;
&lt;li&gt;The resolver fetches the resource and returns the response&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The gateway has no knowledge of concrete resources. As an orientative reference, a possible Java implementation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="n"&gt;gateway&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;register&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"commerce:orders"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;   &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;OrderResolver&lt;/span&gt;&lt;span class="o"&gt;());&lt;/span&gt;
&lt;span class="n"&gt;gateway&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;register&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"finance:accounts"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;  &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;AccountResolver&lt;/span&gt;&lt;span class="o"&gt;());&lt;/span&gt;
&lt;span class="n"&gt;gateway&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;register&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"health:coverage"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;   &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;CoverageResolver&lt;/span&gt;&lt;span class="o"&gt;());&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;interface&lt;/span&gt; &lt;span class="nc"&gt;ResourceResolver&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;Response&lt;/span&gt; &lt;span class="nf"&gt;resolve&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;ResourceIdentifier&lt;/span&gt; &lt;span class="n"&gt;identifier&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Optional preferences
&lt;/h2&gt;

&lt;p&gt;The identifier supports expressing preferences about how the resource should be resolved, with a syntax inspired by HTTP's &lt;code&gt;Accept&lt;/code&gt; header. For example, when querying available payment methods, you can indicate a preference for debit over credit:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;payments:methods/available:customer:id=109234;debit,q=0.9;credit,q=0.7
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The meaning of &lt;code&gt;q&lt;/code&gt; is defined by the contract between whoever builds the reference and whoever resolves it. The gateway doesn't need to interpret it. This capability is completely optional.&lt;/p&gt;




&lt;p&gt;I implemented this in Java and found it useful in practice. If you try it in your own context or have ideas to improve it, I'd love to read them in the comments.&lt;/p&gt;

</description>
      <category>microservices</category>
      <category>design</category>
      <category>architecture</category>
      <category>webdev</category>
    </item>
    <item>
      <title>[ES] Delegated Resource Identifier (DRI): un patrón para referencias persistentes en microservicios</title>
      <dc:creator>Edgardo Genini</dc:creator>
      <pubDate>Wed, 13 May 2026 01:36:45 +0000</pubDate>
      <link>https://dev.to/edgardo_genini/es-delegated-resource-identifier-dri-un-patron-para-referencias-persistentes-en-microservicios-big</link>
      <guid>https://dev.to/edgardo_genini/es-delegated-resource-identifier-dri-un-patron-para-referencias-persistentes-en-microservicios-big</guid>
      <description>&lt;p&gt;&lt;a href="https://dev.to/edgardo_genini/en-delegated-resource-identifier-dri-a-pattern-for-persistent-references-in-microservices-2o52"&gt;También disponible en Inglés&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Si alguna vez guardaste una URL en una base de datos y después te arrepentiste, esto es para vos.&lt;/p&gt;

&lt;p&gt;Es un escenario conocido: un servicio necesita mantener una referencia a un recurso que vive en otro servicio. La solución más obvia es guardar la URL. Funciona, hasta que el host cambia, la API sube de versión, o el equipo decide reestructurar los paths. De repente todas las referencias guardadas están rotas, y rastrear el impacto se convierte en un problema mayor de lo que debería ser.&lt;/p&gt;

&lt;p&gt;El problema de fondo es que una URL mezcla dos cosas distintas: &lt;em&gt;qué es&lt;/em&gt; el recurso y &lt;em&gt;dónde está&lt;/em&gt;. Cuando guardás una URL estás apostando a que esa ubicación no va a cambiar. En sistemas que evolucionan, esa apuesta suele perderse.&lt;/p&gt;

&lt;h2&gt;
  
  
  La idea
&lt;/h2&gt;

&lt;p&gt;¿Qué pasaría si en lugar de guardar dónde está el recurso, guardás un identificador propio que un gateway sabe cómo resolver?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;comercio:pedidos/orden:id=ARG-2024-00091872
finanzas:cuentas/cliente:estado:id=109234
salud:cobertura/credencial:patient-id=12345678
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Quien guarda la referencia no necesita saber dónde vive el recurso ni cómo se accede. Esa responsabilidad la tiene el gateway. Si la API cambia, si el servicio migra, si aparece un sistema nuevo: solo cambia el resolver. Las referencias guardadas siguen siendo válidas.&lt;/p&gt;

&lt;p&gt;A este esquema lo llamé &lt;strong&gt;Delegated Resource Identifier (DRI)&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Lo que este patrón no es
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;No es un estándar&lt;/li&gt;
&lt;li&gt;Requiere un gateway como intermediario: no aplica cuando el cliente necesita acceder directamente al recurso sin pasar por ningún intermediario&lt;/li&gt;
&lt;li&gt;No impone una taxonomía de contextos: cada equipo define la suya&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Es una convención útil cuando necesitás referencias persistentes a recursos en un ecosistema controlado, y querés centralizar la lógica de resolución.&lt;/p&gt;

&lt;h2&gt;
  
  
  Cómo se construye
&lt;/h2&gt;

&lt;p&gt;El identificador tiene dos partes separadas por &lt;code&gt;/&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;contexto&amp;gt;/&amp;lt;recurso&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Contexto&lt;/strong&gt; (lado izquierdo): identifica el dominio que sabe resolver este tipo de recurso. El gateway lo usa para rutear.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Recurso&lt;/strong&gt; (lado derecho): identifica el recurso concreto. Su estructura la define quien implementa el resolver.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;comercio:pedidos/orden:id=ARG-2024-00091872
└─── ruteo ──────┘└─── recurso concreto ──┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Los &lt;code&gt;:&lt;/code&gt; separan niveles jerárquicos. El &lt;code&gt;=&lt;/code&gt; asigna valores. Cada lado define su propia convención interna.&lt;/p&gt;

&lt;p&gt;El identificador lo construye quien guarda la referencia, a partir del dato que ya tiene y el contexto que conoce. No requiere ninguna llamada externa. Un servicio de facturación que recibe el ID de una orden sabe que pertenece a &lt;code&gt;comercio:pedidos&lt;/code&gt; y construye el DRI al momento de persistir la referencia.&lt;/p&gt;

&lt;p&gt;El contexto puede omitirse si el gateway tiene un resolver por defecto:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/orden:id=ARG-2024-00091872
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Algunos casos de uso
&lt;/h2&gt;

&lt;h3&gt;
  
  
  E-commerce: recuperar una orden
&lt;/h3&gt;

&lt;p&gt;Un servicio de atención al cliente guarda referencias a órdenes que pueden venir de distintos canales: tienda propia, marketplace, app móvil. Cada canal tiene su propia API.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;comercio:pedidos/orden:id=ARG-2024-00091872
comercio:pedidos/orden:id=MKT-2024-00034521
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;El resolver de &lt;code&gt;comercio:pedidos&lt;/code&gt; determina a qué canal pertenece cada orden a partir del prefijo del ID y rutea hacia la API correspondiente. El identificador es estable aunque la API del canal cambie.&lt;/p&gt;

&lt;h3&gt;
  
  
  Fintech: estado de cuenta de un cliente
&lt;/h3&gt;

&lt;p&gt;Un banco con sistemas legacy y modernos conviviendo. El resolver determina en qué sistema vive el cliente según el valor del ID: clientes con &lt;code&gt;id &amp;lt; 50000&lt;/code&gt; en el sistema legacy, el resto en el moderno.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;finanzas:cuentas/cliente:estado:id=109234
finanzas:cuentas/cliente:estado:id=002871
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;El resolver encapsula también la decisión de qué versión de la API usar. Y acá aparece algo interesante: el DRI tiene dos momentos de vida. Cuando se persiste es solo el identificador. Cuando se usa para consultar, puede enriquecerse con contexto adicional usando la misma sintaxis:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;finanzas:cuentas/cliente:estado:id=109234:fecha=20260101
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;El resolver puede usar esa fecha para determinar qué versión de la API corresponde. El DRI persistido no cambia; el contexto adicional se agrega en el momento de la consulta.&lt;/p&gt;

&lt;h3&gt;
  
  
  Salud: credencial de cobertura de un afiliado
&lt;/h3&gt;

&lt;p&gt;La cobertura de un afiliado puede cambiar en el tiempo: migración de proveedor, períodos sin cobertura, cobertura en más de uno. Guardar el proveedor como dato fijo generaría referencias desactualizadas.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;salud:cobertura/credencial:patient-id=12345678
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;El resolver aplica una estrategia de fallback: consulta al primer proveedor disponible y si no encuentra la credencial prueba con el siguiente. El DRI resuelve en el momento de la consulta, reflejando siempre el estado actual.&lt;/p&gt;

&lt;h3&gt;
  
  
  Multinacional con tenant: proveedor por entidad legal
&lt;/h3&gt;

&lt;p&gt;Una plataforma SaaS con operaciones en múltiples países. Cada país tiene su propio sistema, su propia API y su propio formato de identificador fiscal.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;tenant:acme:ar/proveedor:cuit=20123456789
tenant:acme:cl/proveedor:rut=76354921-5
tenant:acme:mx/proveedor:rfc=XYZ123456789
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;El lado izquierdo combina tenant y entidad legal por país. El lado derecho respeta la convención local. Agregar una nueva filial o un nuevo tenant es registrar un resolver adicional, sin tocar las referencias existentes. La jerarquía del contexto crece naturalmente con el sistema.&lt;/p&gt;

&lt;h2&gt;
  
  
  Cómo funciona el gateway
&lt;/h2&gt;

&lt;p&gt;El flujo de resolución es simple: el gateway recibe el identificador, extrae el contexto y delega al resolver correspondiente.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cliente  →  gateway  →  resolver(comercio:pedidos)  →  servicio real
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Recibe el identificador&lt;/li&gt;
&lt;li&gt;Extrae el contexto (lado izquierdo)&lt;/li&gt;
&lt;li&gt;Delega al resolver registrado para ese contexto&lt;/li&gt;
&lt;li&gt;El resolver obtiene el recurso y devuelve la respuesta&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;El gateway no conoce recursos concretos. A modo de referencia orientativa, una posible implementación en Java:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="n"&gt;gateway&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;register&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"comercio:pedidos"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;OrderResolver&lt;/span&gt;&lt;span class="o"&gt;());&lt;/span&gt;
&lt;span class="n"&gt;gateway&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;register&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"finanzas:cuentas"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;AccountResolver&lt;/span&gt;&lt;span class="o"&gt;());&lt;/span&gt;
&lt;span class="n"&gt;gateway&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;register&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"salud:cobertura"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;  &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;CoverageResolver&lt;/span&gt;&lt;span class="o"&gt;());&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;interface&lt;/span&gt; &lt;span class="nc"&gt;ResourceResolver&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;Response&lt;/span&gt; &lt;span class="nf"&gt;resolve&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;ResourceIdentifier&lt;/span&gt; &lt;span class="n"&gt;identifier&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Preferencias opcionales
&lt;/h2&gt;

&lt;p&gt;El identificador admite expresar preferencias sobre cómo debe resolverse el recurso, con una sintaxis inspirada en el header &lt;code&gt;Accept&lt;/code&gt; de HTTP. Por ejemplo, al consultar medios de pago se puede indicar preferencia por débito sobre crédito:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pagos:medios/disponibles:cliente:id=109234;debito,q=0.9;credito,q=0.7
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;El significado de &lt;code&gt;q&lt;/code&gt; lo define el contrato entre quien construye la referencia y quien la resuelve. El gateway no necesita interpretarlo. Esta capacidad es completamente opcional.&lt;/p&gt;




&lt;p&gt;Lo implementé en Java y me resultó útil en la práctica. Si lo probás en tu contexto o tenés ideas para mejorarlo, me interesa leerlo en los comentarios.&lt;/p&gt;

</description>
      <category>architecture</category>
      <category>microservices</category>
      <category>design</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
