从另一个Delphi程序中调用Delphi方法 [英] Call Delphi method from another Delphi program
问题描述
我想设置一个小程序,该程序从数据库中检索信息,然后在需要时将该信息分发给另一个程序。例如,一个名为 Master的程序将从数据库中检索数据并创建对象的集合(列表,数组等。效果最好的一个),然后一个名为 Slave的程序(从多个桌面运行)可以调用一个方法(例如,GetNextRecord)从主中检索集合中的下一条记录。
I would like to setup a small program that retrieves info from a database and then distributes that information to another program when requested. For instance, a program called 'Master' would retrieve data from the database and create a collection of objects (list, array, etc. whatever works best) and then a program called 'Slave' (running from multiple desktops) could call a method (i.e., GetNextRecord) from 'Master' to retrieve the next record in the collection.
我希望只能允许一个从属一次调用GetNextRecord方法,以避免给多个从属相同的记录。 主服务器将与数据库一起在服务器上运行,而从服务器将在多台台式机上运行。
I would like to be able to only allow one 'Slave' to be able to call the GetNextRecord method at a time to avoid giving multiple slaves the same record. 'Master' would run on the server with the database while 'Slave' would be running on multiple desktop machines.
有人能举这样的例子还是教程
Does anyone have an example of this or a tutorial on how this is done?
TIA,
Brian Enderle
TIA, Brian Enderle
推荐答案
What you are describing is also known as load balancing, which can be implemented using a Message Queue.
看面向消息的中间件并检查现有的实现,例如 Microsoft消息队列(MSMQ):
Look up Message Oriented Middleware and check existing implementations, like Microsoft Message Queuing (MSMQ):
MSMQ本质上是一种消息传递
协议,允许在单独的服务器/进程上运行的应用程序
在故障保护中进行通信
MSMQ is essentially a messaging protocol that allows applications running on separate servers/processes to communicate in a failsafe manner.
建议阅读也是有关企业集成模式
注意:我是开放消息消息队列/消息代理(ActiveMQ,HornetQ,OpenMQ,RabbitMQ)的Delphi和Free Pascal客户端库的作者
Note: I am the author of Delphi and Free Pascal client libraries for open source message queues / message brokers (ActiveMQ, HornetQ, OpenMQ, RabbitMQ)
这篇关于从另一个Delphi程序中调用Delphi方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!