當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Python ArcGIS RabbitMQ用法及代碼示例

本文簡要介紹 python 語言中 arcgis.realtime.velocity.feeds.RabbitMQ 的用法。

用法:

class arcgis.realtime.velocity.feeds.RabbitMQ(label, description, host, port=5672, use_ssl=False, prefetch_count=0, virtual_host=None, username=None, password=None, queue_name=None, data_format=None, track_id_field=None, geometry=None, time=None)

可選參數:

  • virtual_host: String 。 RabbitMQ 服務器的虛擬主機。例如:虛擬主機1
  • username: String 。服務器身份驗證的用戶名。
  • password: String 。服務器身份驗證的密碼。
  • queue_name: String 。將通過其接收消息的隊列的名稱。
  • data_format: [ EsriJsonFormat GeoJsonFormat DelimitedFormat JsonFormat XMLFormat ]。包含此 feed 的數據格式配置的實例。僅配置允許的格式。如果在初始化期間未正確設置,則會自動檢測格式並根據傳入數據的樣本進行設置。該示例將從 init 中迄今為止提供的配置中獲取。
  • track_id_field: String 。應設置為軌道 ID 的傳入數據字段的名稱。
  • geometry: [XYZGeometrySingleFieldGeometry]。幾何配置的實例,將用於從傳入數據創建幾何對象。
  • time: [TimeInstantTimeInterval]。時間配置實例,將用於根據傳入數據創建時間信息。

返回:

具有RabbitMQ 提要配置的數據類。

從 RabbitMQ 代理接收事件。該數據類可用於定義提要配置並創建提要。

Parameter

Description

label

String 。 feed 實例的唯一標簽。

description

String 。飼料說明。

host

String 。 RabbitMQ 服務器的主機地址。

例如:

rabbitmqbroker.centralus.cloudapp.azure.com

port

國際。可訪問 RabbitMQ 服務器的端口。默認值為:5672。

use_ssl

布爾。是否在連接中使用 SSL。默認值為:False。

prefetch_count

國際。預取計數用於指定RabbitMQ發送的消息數量。這限製了在確認消息之前接收的消息數量。默認值為:0。

例子:

# Usage Example

from arcgis.realtime.velocity.feeds import RabbitMQ
from arcgis.realtime.velocity.feeds.geometry import XYZGeometry, SingleFieldGeometry
from arcgis.realtime.velocity.feeds.time import TimeInterval, TimeInstant

rabbitmq_config = RabbitMQ(
    label="feed_name",
    description="feed_description",
    host="RabbitMQ host",
    username="RabbitMQ_username",
    password="RabbitMQ password",
    prefetch_count=0,
    queue_name="RabbitMQ_queue_name",
    data_format=None
)

# use velocity object to get the FeedsManager instance
feeds = velocity.feeds

# use the FeedsManager object to create a feed from this feed configuration
rabbitmq_feed = feeds.create(rabbitmq_config)
rabbitmq_feed.start()
feeds.items

相關用法


注:本文由純淨天空篩選整理自arcgis.com大神的英文原創作品 arcgis.realtime.velocity.feeds.RabbitMQ。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。