Class SpotifyDispatch

java.lang.Object
org.localify.data.dispatch.SpotifyDispatch

@Component public class SpotifyDispatch extends Object
A service for dispatching Spotify scraping requests.
  • Constructor Details

    • SpotifyDispatch

      public SpotifyDispatch(RabbitSender rabbitSender, com.fasterxml.jackson.databind.ObjectMapper objectMapper, ArtistRepository artistRepository, jakarta.persistence.EntityManager entityManager, EventRepository eventRepository)
      Constructs a new SpotifyDispatch.
      Parameters:
      rabbitSender - The RabbitMQ sender.
      objectMapper - The object mapper.
      artistRepository - The artist repository.
      entityManager - The entity manager.
      eventRepository - The event repository.
  • Method Details

    • dispatchArtistsSpotify

      @Transactional public void dispatchArtistsSpotify(List<Artist> artists, int priority)
      Dispatches a list of artists to be scraped from Spotify.
      Parameters:
      artists - The list of artists to dispatch.
      priority - The priority of the message.
    • queueArtistsUpdatedBefore

      @Transactional(propagation=REQUIRES_NEW) public void queueArtistsUpdatedBefore(Instant time, int limit)
      Queues artists whose events were updated before a certain time.
      Parameters:
      time - The time to check against.
      limit - The maximum number of artists to queue.