package dp.kotul.starter.filter

import java.util.UUID

class RequestCorrelation {
    companion object {
        const val CORRELATION_ID_HEADER = "correlationId"

        private val id: ThreadLocal<String?> = ThreadLocal()

        fun getId(): String {
            if (id.get() == null) {
                id.set(UUID.randomUUID().toString())
            }
            return id.get()!!
        }

        fun setId(correlationId: String?) {
            id.set(correlationId)
        }
    }
}

