0

I'm building a small app that models city public transport network. The idea is that each bus stop is a Sink and listens to messages from other bus stops, thus, calculating times the bus will show up. Bus stops with unique ids are stored in the database and I need to generate and run exactly the number of sinks with unique ids. How do I do that?

My guess is that the task that can be done using Spring Cloud Data Flow that will launch .jar files using (--id) property that'll be injected with @Value notation. But I can't understand how to implement that.

Also found this but it didn't help.

mcfoton
  • 176
  • 5
  • "Spring Cloud" sounds crazy. Is there a specific reason why you're thinking of web programming? Is the final result of this code going to be displayed on a web page? – markspace Dec 07 '17 at 19:32
  • I'm studing Java technologies and that was one of the final assignments: to build a project that'll use Spring Boot for message producer, consumers and backend. Consumers are talking with backend using REST. And I believe Spring Cloud Data Flow does not necessary mean 'web'. From the description I see that it is concerned with producer->consumer pipelines. http://cloud.spring.io/spring-cloud-dataflow/ – mcfoton Dec 07 '17 at 19:55

1 Answers1

0

You got some of the concepts correctly, but your implementation may need some help.

So Spring Cloud Dataflow is an orchestration engine that deploys boot applications and connects them using a middleware.

Those apps can be Streaming apps, which mean they use Spring Cloud Stream as an abstraction layer to communicate with a middleware (Rabbit or Kafka), and in its core it has three types of apps: Sources (data emitters), Processors (data transformation) and sinks (data receivers)

You use dataflow to combine those and deploy to a runtime (Local, CloudFoundry, K8S, YARN)

So, yes SCDF can be used for your assignment, however you do not want to create one sink per bus, this is abusing your resources.

You can have a simple stream that captures the data from your buses (the source), maybe do some transformation and sinks it to a DB

You can then create a tap that listens to the messages stored in a DB if you are interested in processing them.

You can tap that information and have a client that broadcasts it downstream (your display at each bus stop)

So for example you can have just one single sink, but have a websocket for example where each client connects and passes an id. You can then forward the events received filtered by that id to this specific client.

This is a much more efficient way to deal with that.

Vinicius Carvalho
  • 3,994
  • 4
  • 23
  • 29