package de.thpeetz.kontor.integration.services;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.HashMap;

@Service
@Slf4j
public class AddLinkService {

    public void fromQueue(String messageBody) throws JsonProcessingException {
        log.info("get body: {}", messageBody);
        ObjectMapper objectMapper = new ObjectMapper();
        HashMap<String,String> myMap = objectMapper.readValue(messageBody, new TypeReference<HashMap<String,String>>() {});
        String url = myMap.get("url");
        log.info("found url: {}", url);
    }
}
