Commit 0cfca900 authored by Claes Sjofors's avatar Claes Sjofors

Remote, remnode and remote support for RabbitMQ added

parent e30bad15
include $(pwre_dir_symbols)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq ($($(type_name)_generic_mk),)
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq ($($(type_name)_generic_mk),)
include $(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
ifndef link_rule_mk
link_rule_mk := 1
link = $(ldxx) $(elinkflags) $(domap) -o $(export_exe) \
$(export_obj) $(objects) $(rt_msg_eobjs) \
$(pwre_conf_libdir) $(pwre_conf_libpwrremote) $(pwre_conf_libpwrrt) \
-lrabbitmq $(pwre_conf_lib)
endif
This diff is collapsed.
......@@ -187,6 +187,30 @@ static void AddTransports()
sts = gdh_GetNextObject (objid, &objid);
}
/* Get and configure all RabbitMQ remnodes, one process for each remnode */
sts = gdh_GetClassList (pwr_cClass_RemnodeRabbitMQ, &objid);
while ( ODD(sts))
{
sts = gdh_ObjidToPointer(objid, &objref);
sprintf(tp[tpcount].path, "rs_remote_rabbitmq");
tp[tpcount].id = id++;
tp[tpcount].disable = &((pwr_sClass_RemnodeRabbitMQ *) objref)->Disable;
tp[tpcount].restart_limit = &((pwr_sClass_RemnodeRabbitMQ *) objref)->RestartLimit;
tp[tpcount].restarts = &((pwr_sClass_RemnodeRabbitMQ *) objref)->RestartCount;
((pwr_sClass_RemnodeMQ *) objref)->RestartCount = 0;
tp[tpcount].objid = objid;
tp[tpcount].objref = objref;
tp[tpcount].classid = pwr_cClass_RemnodeRabbitMQ;
tp[tpcount].cpid = -1;
tp[tpcount].first = true;
remcfgp->RemNodeObjects[tpcount] = objid;
tpcount++;
sts = gdh_GetNextObject (objid, &objid);
}
/* Get and configure all QCom remnodes, one process for each remnode */
sts = gdh_GetClassList (pwr_cClass_RemnodeQCom, &objid);
......
!
! Proview Open Source Process Control.
! Copyright (C) 2005-2017 SSAB EMEA AB.
!
! This file is part of Proview.
!
! This program is free software; you can redistribute it and/or
! modify it under the terms of the GNU General Public License as
! published by the Free Software Foundation, either version 2 of
! the License, or (at your option) any later version.
!
! This program is distributed in the hope that it will be useful
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU General Public License for more details.
!
! You should have received a copy of the GNU General Public License
! along with Proview. If not, see <http://www.gnu.org/licenses/>
!
! Linking Proview statically or dynamically with other modules is
! making a combined work based on Proview. Thus, the terms and
! conditions of the GNU General Public License cover the whole
! combination.
!
! In addition, as a special exception, the copyright holders of
! Proview give you permission to, from the build function in the
! Proview Configurator, combine Proview with modules generated by the
! Proview PLC Editor to a PLC program, regardless of the license
! terms of these modules. You may copy and distribute the resulting
! combined work under the terms of your choice, provided that every
! copy of the combined work is accompanied by a complete copy of
! the source code of Proview (the version used to produce the
! combined work), being distributed under the terms of the GNU
! General Public License plus this exception.
!
! remote_c_remnoderabbitmq.wb_load -- Defines the class RemnodeRabbitMQ.
!
SObject Remote:Class
!/**
! @Version 1.0
! @Group Servers,NodeConfiguration
! @Summary Configures communication through a message queue using RabbitMQ.
! Configures communication through a message queue using RabbitMQ.
!
! To direct a message from a sending RemTrans to a recieving RemTrans set
! same value (0 - 255) in Address[0] in both sending and receiving RemTrans.
!
! @b Object graph
! @image orm_remnoderabbitmq_og.png
!
! @b See also
! @classlink RemoteConfig remote_remoteconfig.html
! @classlink RemTrans remote_remtrans.html
!*/
Object RemnodeRabbitMQ $ClassDef 35
Body SysBody
Attr Editor = pwr_eEditor_AttrEd
Attr Method = pwr_eMethod_Standard
Attr PopEditor = 2
EndBody
Object RtBody $ObjBodyDef 1
Body SysBody
Attr StructName = "RemnodeRabbitMQ"
EndBody
!/**
! Optional description.
!*/
Object Description $Attribute 1
Body SysBody
Attr TypeRef = "pwrs:Type-$String80"
EndBody
EndObject
!/**
! Process priority for the transport process. For future use.
!*/
Object Prio $Attribute 2
Body SysBody
Attr TypeRef = "pwrs:Type-$Int32"
EndBody
EndObject
!/**
! Server node or broker.
!*/
Object Server $Attribute 3
Body SysBody
Attr TypeRef = "pwrs:Type-$String80"
EndBody
EndObject
!/**
! RabbitMQ port. The default port for RabbitMQ is 5672.
!*/
Object Port $Attribute 4
Body SysBody
Attr TypeRef = "pwrs:Type-$UInt32"
EndBody
EndObject
!/**
! RabbitMQ channel.
!*/
Object Channel $Attribute 5
Body SysBody
Attr TypeRef = "pwrs:Type-$UInt32"
EndBody
EndObject
!/**
! Name of exchange. If empty, the default exchange is used.
!*/
Object Exchange $Attribute 6
Body SysBody
Attr TypeRef = "pwrs:Type-$String80"
EndBody
EndObject
!/**
! Name of send queue.
! The queue is created if it doesn't exist.
!*/
Object SendQueue $Attribute 7
Body SysBody
Attr TypeRef = "pwrs:Type-$String80"
EndBody
EndObject
!/**
! Name of receive queue.
! The queue is created if it doesn't exist.
!*/
Object ReceiveQueue $Attribute 8
Body SysBody
Attr TypeRef = "pwrs:Type-$String80"
EndBody
EndObject
!/**
! Username for broker connection.
! The user has to be created in the broker.
!*/
Object User $Attribute 9
Body SysBody
Attr TypeRef = "pwrs:Type-$String40"
Attr Flags |= PWR_MASK_CONST
EndBody
EndObject
!/**
! Password for the broker connection.
!*/
Object Password $Attribute 10
Body SysBody
Attr TypeRef = "pwrs:Type-$String40"
Attr Flags |= PWR_MASK_CONST
Attr Flags |= PWR_MASK_RTHIDE
Attr Flags |= PWR_MASK_DEVHIDEVALUE
EndBody
EndObject
!/**
! Acknowlege is required for all messages.
! Send messages will not removed from the queue unless an aknowlege is received
! from the receiver.
! For received messages an acknowlege messages is send to the broker.
! If Acknowlege is not sent, messages will be removed from the queue when they are sent.
!*/
Object Acknowledge $Attribute 11
Body SysBody
Attr TypeRef = "pwrs:Type-$Boolean"
EndBody
EndObject
!/**
! Queued messages are stored on disk by the broker, and will be recovered after a
! restart.
!*/
Object Durable $Attribute 12
Body SysBody
Attr TypeRef = "pwrs:Type-$Boolean"
EndBody
EndObject
!/**
! Scantime in seconds for outgoing RemTrans messages.
! Dynamic change is possible.
!*/
Object ScanTime $Attribute 14
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
EndBody
EndObject
!/**
! When set, this attribute tells the remote handler not to start
! or restart the process that handles this remote node. If the transport process
! is running while the attribute is set it will terminate. This can be used to force
! a restart of the process.
!*/
Object Disable $Attribute 15
Body SysBody
Attr TypeRef = "pwrs:Type-$Boolean"
EndBody
EndObject
!/**
! This attribute shows how many times the remote handler has restarted the
! transport process that handles this remnode.
! Dynamic change is possible and can be used in order to earn more restarts.
!*/
Object RestartCount $Attribute 16
Body SysBody
Attr TypeRef = "pwrs:Type-$UInt32"
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_NOEDIT
Attr Flags |= PWR_MASK_INVISIBLE
EndBody
EndObject
!/**
! The restart limit tells the remote handler how many times the transport process
! that handle this remnode can be restarted.
! Dynamic change is possible and can be used in order to earn more restarts.
!*/
Object RestartLimit $Attribute 17
Body SysBody
Attr TypeRef = "pwrs:Type-$UInt32"
EndBody
EndObject
!/**
! The restart time is set by the transport process at startup and therefore
! shows the latest (re)starttime.
!*/
Object RestartTime $Attribute 18
Body SysBody
Attr TypeRef = "pwrs:Type-$Time"
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_NOEDIT
Attr Flags |= PWR_MASK_INVISIBLE
EndBody
EndObject
!/**
! When set, this attribute disables use of the special Remote header
! in each send message. Furthermore, when receiving a message, the whole part
! of the message is treated as data which means that it is not possible to
! tell which ingoing RemTrans object the message is meant for since this information
! lies in the header. Therefore each incoming message is placed in the first found
! RemTrans object.
! Dynamic change is possible.
!*/
Object DisableHeader $Attribute 19
Body SysBody
Attr TypeRef = "pwrs:Type-$Boolean"
EndBody
EndObject
!/**
! Error counter.
!*/
Object ErrCount $Attribute 20
Body SysBody
Attr TypeRef = "pwrs:Type-$UInt32"
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_NOEDIT
Attr Flags |= PWR_MASK_INVISIBLE
EndBody
EndObject
!/**
! Type of remnode. Used in the RemoteConfig classgraph.
!*/
Object Id $Attribute 21
Body SysBody
Attr TypeRef = "pwrs:Type-$String8"
Attr Flags |= PWR_MASK_INVISIBLE
EndBody
EndObject
!/**
! Contains the objid for the RemTrans objects for this remnode.
! The objid's are inserted by the remote process.
!*/
Object RemTransObjects $Attribute 22
Body SysBody
Attr TypeRef = "pwrs:Type-$Objid"
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_INVISIBLE
Attr Flags |= PWR_MASK_ARRAY
Attr Elements = 25
EndBody
EndObject
EndObject
Object Template RemnodeRabbitMQ
Body RtBody
Attr Server = "localhost"
Attr Port = 5672
Attr Channel = 1
Attr User = "guest"
Attr Password = "guest"
Attr Prio = 15
Attr RestartLimit = 100
Attr ScanTime = 0.1
Attr Id = "RabbitM"
EndBody
EndObject
EndObject
EndSObject
......@@ -60,6 +60,7 @@ pkg_install_func ()
chmod a+x pkg_unpack.sh
./pkg_unpack.sh $pkg
rm ./pkg_unpack.sh
}
pkg_list_func ()
......
......@@ -82,3 +82,4 @@ udpweirdheader <UDP message with illegal header received> /info
disorder <Message disorder> /error
disabled <Transport disabled> /error
udpnocon <No UDP connection> /error
exception <Exception from connection> /error
......@@ -1737,7 +1737,7 @@ int XNav::show_remnode()
strcpy( th.title[th.table_cnt++], "Description");
new ItemTableHeader( brow, this, "Title", &th, NULL, flow_eDest_IntoLast);
for ( int i = 0; i < 9; i++) {
for ( int i = 0; i < 10; i++) {
switch ( i) {
case 0: cid = pwr_cClass_RemnodeUDP; break;
case 1: cid = pwr_cClass_RemnodeTCP; break;
......@@ -1748,6 +1748,7 @@ int XNav::show_remnode()
case 6: cid = pwr_cClass_RemnodeMQ; break;
case 7: cid = pwr_cClass_RemnodeWMQ; break;
case 8: cid = pwr_cClass_RemnodeQCom; break;
case 9: cid = pwr_cClass_RemnodeRabbitMQ; break;
}
sts = gdh_GetClassList( cid, &objid);
......@@ -1805,6 +1806,11 @@ int XNav::show_remnode()
strncpy( description, ((pwr_sClass_RemnodeQCom *)object_ptr)->Description,
sizeof(description));
break;
case 9:
strncpy( id, ((pwr_sClass_RemnodeRabbitMQ *)object_ptr)->Id, sizeof(id));
strncpy( description, ((pwr_sClass_RemnodeRabbitMQ *)object_ptr)->Description,
sizeof(description));
break;
}
t.elem_cnt = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment