Giter VIP home page Giter VIP logo

Comments (9)

kaspernielsen avatar kaspernielsen commented on August 20, 2024

Hi Malte,

You can only get it from an AisPacket (Which encapsulates an AisMessage)
The whole source id thing is a non-standard but we use internally to distinguish between AIS data that comes in from different data sources.

from aislib.

kaspernielsen avatar kaspernielsen commented on August 20, 2024

You can see here, how we tag the AisPacket

https://github.com/dma-ais/AisLib/blob/master/ais-lib-communication/src/main/java/dk/dma/ais/reader/AisReader.java#L292

Use AisPacket.getPacketTags().getSourceId() to get it

from aislib.

mablae avatar mablae commented on August 20, 2024

Exactly, I do the same... :)

I have hacked get/set SourceId into AisMessage and set them in AisReader - works...
So I can do aisMessage.getSourceId() in MessageHandler...

Any chance to get this merged in master?

Thanks for the quick reply! Greeting from Bremen 👍

mablae

from aislib.

kaspernielsen avatar kaspernielsen commented on August 20, 2024

AisPacket and AisMessage is layered much like, for example tcp/ip .
AisPacket contains all the metadata (tcp/ip header) + Ais Message (the payload).
AisMessage is strictly stuff that is in the AIS specification (payload).

Don't know if its clear?

Maybe you want to use AisPacket instead in those places?

from aislib.

mablae avatar mablae commented on August 20, 2024

The thing is that I need the Douplet Filter - That is only for AisMessages...

After that in my message handler I push the decoded message to a RabbitMq broker as a JSON Object. Then some other process fetches the messages from Rabbit and inserts them into Database.

I use RabbitMq as some Kind of "buffer"

from aislib.

kaspernielsen avatar kaspernielsen commented on August 20, 2024

Are you talking about dk.dma.ais.filter.DuplicateFilter?
Because it extends MessageFilterBase which both implements IPacketFilter and IMessageFilter

from aislib.

mablae avatar mablae commented on August 20, 2024

Oh, maybe I just need to dig deeper then. Thanks for your help!

from aislib.

kaspernielsen avatar kaspernielsen commented on August 20, 2024

No worries, let me know if you have any questions

from aislib.

mablae avatar mablae commented on August 20, 2024

Hey,

I refactored my code to do the casting to AisMessage after filtering in one AisPacket Consumer.

It works perfect! Thanks again. 👍

from aislib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.