Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: CAMEL-7674

...

Maven users will need to add the following dependency to their pom.xml for this component:

Code Block

	<dependency>
    	<groupId>org.apache.camel</groupId>
    	<artifactId>camel-facebook</artifactId>
    	<version>${camel-version}</version>
	</dependency>

URI format

Code Block

  facebook://[endpoint]?[options]

...

Producer endpoints can also use a special option *inBody* that in turn should contain the name of the endpoint option whose value will be contained in the Camel Exchange In message. For example, the facebook endpoint in the following route retrieves activities for the user id value in the incoming message body.

Code Block

	from("direct:test").to("facebook://activities?inBody=userId")...

...

Any of the producer endpoints that take a reading reading#reading parameter can be used as a consumer endpoint. The polling consumer uses the since and until fields to get responses within the polling interval. In addition to other reading fields, an initial since value can be provided in the endpoint for the first poll.

...

The reading option of type facebook4j.Reading adds support for reading parameters, which allow selecting specific fields, limits the number of results, etc. For more information see Graph APIAPI#reading - Facebook Developers.

It is also used by consumer endpoints to poll Facebook data to avoid sending duplicate messages across polls.

...

Message header

Any of the URI optionsoptions#urioptions can be provided in a message header for producer endpoints with CamelFacebook. prefix.

...

To create a post within your Facebook profile, send this producer a facebook4j.PostUpdate body.

Code Block

	from("direct:foo")
		.to("facebook://postFeed/inBody=postUpdate);

To poll, every 5 sec .(You can set the polling consumer options by adding a prefix of "consumer"), all statuses on your home feed:

Code Block

	from("facebook://home?consumer.delay=5")
		.to("bean:blah");

...

In the bar header we have the Facebook search string we want to execute in public posts, so we need to assign this value to the CamelFacebook.query header.

Code Block

	from("direct:foo")
		.setHeader("CamelFacebook.query", header("bar"))
		.to("facebook://posts");