NServiceBus Outbox pattern with SQL question - nservicebus

Im trying to figure out how exactly outbox is suppose to work with NServicebus but I'm not quite sure I get it. Here is the current scenario that we have:
Service1
Service2
Service3
ServiceN
Each of the services has its own database where it holds business data and servicebus shared database used for queue/message broker.
This means that each of these services is using the same connection string for servicebus and has different connection string for business database.
The problem we are facing is that saving into business database and publishing is technically saving into 2 databases, so this will create distributed transaction if wrapped into transaction.
Now, Im considering implementing outbox pattern to solve this problem, but NServiceBus documentation doesnt really give us an idea regarding this question:
Where should Outbox table be stored? Is it suppose to be stored in a same database as bussiness data? Where will the subsciption data be stored in this case for given service? Is it possible to configure NServicebus to create outbox table into bussiness database while the rest of the tables are created in service bus database?
By enabling outbox NServiceBus indeed creates new table for holding messages servicename_Outbox table, but should it be stored into Servicebus database or business data database? If its stored in servicebus database then, technically to save data into it it still needs distributed transaction?
How does servicebus know which table to pool for Outbox pattern and to dispatch messages? Can this be explicitly configured?

Where should Outbox table be stored? Is it suppose to be stored in a same database as bussiness data?
Yes
Where will the subsciption data be stored in this case for given service?
If you use message driven pubsub instead of native pubsub then yes.
Is it possible to configure NServicebus to create outbox table into bussiness database while the rest of the tables are created in service bus database?
Yes, that is expected.
but should it be stored into Servicebus database or business data database? If its stored in servicebus database then, technically to save data into it it still needs distributed transaction?
Outbox data is stored in the business database and share the same storage connection/transaction so does not require a distributed transaction.
How does servicebus know which table to pool for Outbox pattern and to dispatch messages?
Each endpoint has its own entity.
Can this be explicitly configured?
Please check the outbox configuration for the persister that you are using to see if the table name van be configured:
https://docs.particular.net/persistence/

Related

Identify Records in a SQL Database that have been created or modified since the BW Process last executed

I need to identify records in a database that have been updated or created since the previous execution of my BW process. My process will execute every 5 minutes, and my plan was to identify the rows by comparing the last_modified_timestamp field in the database to the system time minus 5 minutes. However, this would not take into account periods where my process could be offline/down for maintenance etc. So I was thinking that if I can just track the timestamps when my process runs, I could then compare the timestamp to that and not have to worry about periods of the process being down.
What would the proper approach be to get around this issue?
Thanks for the help! (I am new to Tibco and apologies if this is a simple question or if I am missing something fundamental)
not sure which version of Tibco you are using. You can try to leverage Tibco Database Adapter for your needs.
Tibco Database Adapter is used for enabling communication between
TIBCO processes and database system. There are two types of services
that can be used with a database adapter:
Publication Service Adapter Publication service extracts data from the
changed rows of a database table and publishes them on appropriate
subject names which are then subscribed by adapter subscriber process
starter.
Subscription Service Subscription service of a database adapter does
opposite to a publication service. When running as a subscriber,
database adapter listens on a subject, receives messages and updates
the relevant tables in its associated database.
Please see tutorial here:
https://tutorialspedia.com/tibco-database-adapter-step-by-step-tutorial/
Adapter for Database concept document:
https://docs.tibco.com/pub/activematrix-adapter-for-database/6.0.0_april_2009/adbadapter/pdf/tib_adadb_concepts.pdf

Azure cloud. One database per (asp.net registered) client

Good morning,
I am using an asp.net framework with an azure client database.
I am now creating another server on Azure to host databases. On this server, for each customer registering on the website (for which 1 entry is created in my first database), I need to create a database with 8 tables - identical for each customer.
What would be the best thing to map the ASP.NET ID to a new database? Which framework would you recommend?
Thanks
Rather than running a VM where you're going to have to manage a SQL Server installation and write a bunch of code to handle a database per tenant scenario, I highly, highly, highly recommend taking a look at Azure SQL's multi-tenant sharding support. All of this code is already written for you. And it's not that you're paying for one DB per client - check out elastic pooling.
You can read the docs here.
Also note, this option will scale very well.
I have done this three different ways: a database per client where I wrote my own code to manage sharding, a single database with a separate schema per client (a huge pain in the rear), and using Azure SQL sharding support. It's not just the issue of correctly separating client data. You also need to think about querying for reporting across all client databases, and managing schema changes. Under the first two options, if you change a schema, you get to modify N client databases. Azure SQL's sharding tools will manage this for you.

How do I use AzureStoragePersistence and Outbox at the same time?

So I was moving my NSB setup off of SQL server and onto azure service bus and figured I might as well use azure storage for persistence as well. I'm unclear on how to set this up because I'm also using outbox and I can't use azure storage with it. I'm using the web.config for connections strings, and it sort of only lets me set NServiceBus/Persistence once, so ... I'm a bit lost
Unfortunately, due to various reasons the outbox is only supported on SQL-Server and RavenDb. Read more about it here : https://docs.particular.net/nservicebus/outbox/
At the bottom of the document there's a note that only those two persisters support the outbox feature.
Add to what Dennis said - you cannot use Storage Persistence with the Outbox feature. Outbox feature requires business data and outgoing transaction to participate in the same transaction. This is only possible with Azure SQL server. With Azure Storage persistence this is not an option. Storage supports table batched operations, but not transactions.

Is there any strong support for SQL database to persist rabbitmq message

We have achieved persistent mechanism with activemq as it has built in support to store messages in SQL database.
But our requirement to store message in SQL using rabbitmq but after some research we are unable to find any strong support or help for this.
Any suggestion would be great help to us.
RabbitMQ uses Mnesia DB to store the definitions about queues/exchanges etc. and it uses a custom DB to store the messages.
Right now, with RabbitMQ is not possible to use an external database to store the messages as ActiveMQ
maybe in the future.

Entities and multiple databases

We've got the following scenario:
Central Database (replicated across multiple servers)
Client Database 1
Client Database 2
The Central db has Users and Roles amongst other things
The Client dbs have similar tables to each other but with some fields tweaked - contact, address, etc...
At present, each client db has its own user/role information which is copied from the central db by a scheduled process. I want to retrieve the user/role information directly from the central db instead (bearing in mind tables in the client db make reference to the user entity)
Is this even possible? If not, what's a better approach for having central user configuration across multiple databases?
Does this mean that you have referential integrity between tables?
bearing in mind tables in the client
db make reference to the user entity
If yes, as long as you have referential integrity between tables they must be in the same database. That points to your current solution being the best.
If no then linked tables would be the way to go, the tables would appear to be local, but the data would be retrieved from the cental database each time.
You EF4 will also not generate linked tables.
Your other option would to go for a more service orientated architecture, creating a user service connected to a web service. But this is probably a lot of work.